The tool in question fires an external .py via execfile. Here is the script of the tool-
execfile(hou.getenv("HOUDINI_CLOUD_PREF_DIR") + '/python2.7libs/testExec.py')
“HOUDINI_CLOUD_PREF_DIR” is a custom environment variable I work with to move preferences off the local machine and onto a network.
Inside of the testExec.py resides the below Python (example simplified)-
from module.newModule import ClassModule as CM def tester(): CM().testFire() tester()
Now, when I click on the shelf tool directly, everything in this script works as expected. module.newModule picks up, ClassModule is imported in fine as CM. CM().testFire() fires an internal function of ClassModule that does a simple print statement for testing.
When executing the tool via “toolutils.testTool()” however, it's a completely different story and an error-
"NameError: global name 'CM' is not defined"
with the following traceback to toolutils-
File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.431/houdini/python2.7libs\toolutils.py", line 1975, in testTool exec(tool.script(), globals(), locals()) File "<string>", line 1, in <module>
Would anyone be able to please give me a hand sorting out of I'm doing something weird or if a RFE bug report needs to be submitted? I'd expect toolutils.testTool() to yield the same results as manually clicking on the shelf tool.
Thank you,
Clayton