Is the sub_form returned a dictionary of key/value pairs (e.g., component-name/component-value) for the instantiated MySubForm Form?
By the way, you read my mind. I was thinking of providing two Side links in the Left navigation bar to allow a user to toggle between MySubForm1 and MySubForm2 views, but I don’t want lose their state (i.e., their attribute settings) when toggling / navigate away momentarily. I don’t know if the routing module helps here, but I’ll read it.
But before getting ahead of myself, this comment you made may be sufficient (and I can read the routing module docs some other time b/c I’m so low on time):
The cool thing is that a form object can be added and removed and, as long as there is a variable referencing it, it will still exist.
Do you have a recommendation on where to safely store these sub-form-object references? For example, maybe in attributes of the top-level Form (Main in my case), like this:
self.subForm1_ref = <statement that returns reference to SubForm1 object>
self.subForm2_ref = <statement that returns reference to SubForm2 object>
What do you think? (I guess I slipped in two questions). Thank you.
The tag property is available on all forms and all components, and it’s the right tool if you want to attach any kind of info to any kind of component.
But for a form you can just add a member to the form class. That’s what you commonly do in the __init__ of a form, and it will also appear in the auto complete (with the known limitations).
The routing module solves the problems you’re trying to solve, plus others besides and takes into account various edge cases. I can’t recommend it highly enough.