cant seem to get parameter from method is pythonModule

   479   2   0
User Avatar
Member
81 posts
Joined: Aug. 2006
Offline
This is driving me crazy, and google is not being helpful.
I am trying to read a parameter from my HDA in a method and it just is not working, it seems so simple but I cant find any examples showing this working. Any help greatly appreciated!

Attachments:
2023-12-03_10-52-03.png (133.0 KB)

User Avatar
Member
143 posts
Joined: May 2017
Offline
Hey,
pwd returns the reference to the current node from where the function is being called. Since you are referring to the Python module from a node /sphere1/ inside the HDA, you will get an error message as the Sphere does not have the parameter "newparameter".

You could now rewrite the function in your Python module to return a reference to the parent node:
def testnode():
    newparametervalue = hou.node("../").parm("newparameter").eval()
    #or
    newparametervalue = hou.pwd().parent().parm("newparameter").eval()
    return newparametervalue

And access the function from the sphere like this:
hou.node("../").hdaModule().testnode()
User Avatar
Member
81 posts
Joined: Aug. 2006
Offline
viklc
Hey,
pwd returns the reference to the current node from where the function is being called. Since you are referring to the Python module from a node /sphere1/ inside the HDA, you will get an error message as the Sphere does not have the parameter "newparameter".

You could now rewrite the function in your Python module to return a reference to the parent node:
def testnode():
    newparametervalue = hou.node("../").parm("newparameter").eval()
    #or
    newparametervalue = hou.pwd().parent().parm("newparameter").eval()
    return newparametervalue

And access the function from the sphere like this:
hou.node("../").hdaModule().testnode()

It looks so obvious now, that works!
thank you. Houdini is the king of giving me imposter syndrome lol
  • Quick Links