Let's say we have a layout with a Text object named "Text" and create a script in the script editor:
Text.Text = "Boo!"
We place this script under a "start of layout"-event and run the app. The text is set to "Boo!", just like it was intended.
If we now save this script as a module named "boo.py" in the appropriate folder and replace the script in the script editor with
and run it, we get the error "global name 'Text' is not defined". Obviously, the interpreter is not aware anymore, that Text is a reference to the text object. Of course, by extending the function with a parameter textobject and in the code using this reference (textobject.Text = "Boo!") it works again.
But what to do, if there is no input possible? Is there another way to reference an object? The above was just an example, what I really would like to access from within my own module are a few attributes from System, like System.AppPath
The script editor resolves the references on the first code layer correctly, so there must be a way. Can someone point me to the right direction?