Automatting Python Scripts - Error: "getCurrentModel()" is not defined
Posted: Tue Mar 12, 2019 4:29 am
Hello community,
I'm working on some new modifications within the GUI. What I try to realize is an automatic script execution to add new bodies. For that I created a python script. If I execute it manually via GUI and Scripts > Run it works without problems.
Now I am trying to use a PythonInterpreter that executes it automatically when clicking on a button. I created a "helper" package similar to the Scripting Shell Subproject for that. First it executes ModelBuildingFunctions.py; second it should execute a CreateNewBody.py script that adds a sphere.
Unfortunately it does not work as I expected. I get this error:
I am not very familiar with python, so I am a bit clueless why it does not work. Do you have any idea what sort of access is missing here?
I'm working on some new modifications within the GUI. What I try to realize is an automatic script execution to add new bodies. For that I created a python script. If I execute it manually via GUI and Scripts > Run it works without problems.
Now I am trying to use a PythonInterpreter that executes it automatically when clicking on a button. I created a "helper" package similar to the Scripting Shell Subproject for that. First it executes ModelBuildingFunctions.py; second it should execute a CreateNewBody.py script that adds a sphere.
Unfortunately it does not work as I expected. I get this error:
Code: Select all
Traceback (most recent call last):
File "../../../../CreateNewBody2.py", line 9, in <module>
model = getCurrentModel().clone()
NameError: name 'getCurrentModel' is not defined