I've created a few useful python method for use in expressions. To load them automatically when houdini starts, I created $HOME/houdini9.0/scripts/python/pythonrc.py and $HOME/houdini9.0/scripts/python/mymodule.py
pythonrc.py:
import mymodule.py
mymodule.py:
def foo(val):
return 1.0-val
In the python shell, this works as expected:
>>> mymodule.foo(0.1)
>>> 0.9
However, in an expression, I get “mymodule is not defined” errors. Changing the expression to be multiline and explicitly doing the import works. I.e. this works:
import mymodule
return mymodule.foo(0.1)
But this does not:
mymodule.foo(0.1)
So, it looks to me like expressions do not use pythonrc.py correctly.
(In houdini 9.0.794)
Also, the instructions given for accessing python methods stored inside an otl doesn't seem to work for expressions. i.e. using hou.node(“..”).hdaModule().foo(0.1) results in errors even if foo is defined in the PythonSection of the otl containing the node using the expression.
cheers,
-Mark
bug: python expressions do not respect pythonrc.py
2146 0 0- mark_visser
- Member
- 71 posts
- Joined:
- Offline
-
- Quick Links