python otl doubt

   2260   2   0
User Avatar
Member
71 posts
Joined: Feb. 2010
Offline
Hi I am writing a small shelf tool
I written a module in the script

any idea of how to import a module in script section of type properties by python script?

we can do this by going and r.clicking and going to type properties window.
but i want to know how this can be done by script.
so that when i click the shelf tool,the module also can be run
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Assuming your asset has a function called foo() in the PythonModule you can do something like this:
node = hou.node(“/path/to/my/node”)
node.hdaModule().foo()
You can also do it without an instance of the node as well:
node_type = hou.nodeType(hou.sopNodeTypeCategory(), “myhda”)
node_type.hdaModule().foo()

In this case ‘myhda’ is the node type name of your asset and it is a SOP.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
71 posts
Joined: Feb. 2010
Offline
@Graham
I think the above code only prints the contents inside which is present inside my module

I want to inject the .py file or have my module inside the PYTHON MODULE EVENT HANDLER whenever i create the otl
  • Quick Links