I’m struggling to get this to work as I write a function in one of the embedded forms. When I tested this, I added a variable to the init function of my main form. When I try to call print(get_open_form().test_variable) from my embedded form, I get:
AttributeError: 'NoneType' object has no attribute 'test_variable'
get_open_form() is None in the form __init__ when a form is dragged inside the startup form. If the same form is loaded dynamically it works as expected.
Apologies for the confusion - this is in fact correct behaviour when the app is first starting up!
The reason is that a form must be constructed before it is opened. So, while the startup form’s __init__() is running, there is no open form, and get_open_form() returns None!
If you want to do something when the form appears on the screen, you can use the show event. By the time the show event fires, the form is already on the page, so get_open_form() will return something.