art3mis Posted May 18, 2017 Share Posted May 18, 2017 (edited) Can any Python experts tell me why I get Quote File "hou.session", line 9, in <module> NameError: name 'hou' is not defined with the following script entered in the Python Source Editor? def set_opencl(parent_node, parm_value): for node in parent_node.allSubChildren(): for p in node.parms(): if p.name()=='opencl': try: p.set(parm_value) except hou.PermissionError: #this handles the case that the parm is inside of a locked .otl pass hou.session.set_opencl(hou.node('/obj/sim'),1); Houdini 16.0.597 Indie in Linux Edited May 18, 2017 by art3mis Quote Link to comment Share on other sites More sharing options...
jkunz07 Posted May 18, 2017 Share Posted May 18, 2017 The last line shouldn't go into the session module. You should type it into a python shell to use that function from the session module. It also shouldn't have a semicolon at the end. Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted May 22, 2017 Share Posted May 22, 2017 (edited) That is a long-standing "bug", if you didn't put import hou in hou.session module, it will work until first error (any python exception), once you get an error, hou module gets lost for some reason. So, just always do import hou. Edited May 22, 2017 by Stalkerx777 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.