[python] NameError: name 'hou' is not defined

   6747   2   1
User Avatar
Member
351 posts
Joined: June 2016
Offline
Can any Python experts tell me why I get
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 by art3mis - May 17, 2017 20:03:06
User Avatar
Member
8062 posts
Joined: July 2005
Offline
Add import houto the list of modules that you import?
User Avatar
Member
1 posts
Joined: Jan. 2019
Offline
yeah, that works. strange , the consule says hou.session module. But it doesnt work with our importing the module manually
  • Quick Links