The docs mention that pythonrc.pywill be automatically executed if placed in pythonX.Ylibs/ folder (source [www.sidefx.com]).
The massive downside for this approach is that if I have the exact same pythonrc.pyfor multiple houdini versions that use different python versions, I now need to make multiple pythonX.Ylibs folders with identical copies of the script.
Is there any way to make Houdini recognize it and execute it from a custom folder? I tried adding my package folder to $PYTHONPATH, as well as the scripts folder without success.
As a followup, what the docs also don't mention is that unless you really do have a need for different files for different Python versions, the only other real usecase for putting things in pythonX.Ylibs folders is that it's the only way you can currently override shipped Houdini modules in the $HH/pythonX.Ylibs folder.
Because of how Houdini sets up sys.path at startup time, $HH/pythonX.Ylibs will always come BEFORE any $HOUDINI_PATH/scripts/python entries, but AFTER any $HOUDINI_PATH/pythonX.Ylibs locations. This means that if you need to override anything in $HH/pythonX.Ylibs, you need to have your overridding modules in a pythonX.Ylibs folder.
I've definitely been guity of this too in the past until figuring it out and I generally put all my stuff under scripts/python now, expect when needing the specific overridding behavior such as using a custom nodegraphhooks.py to add network editor events
Edited by graham - Feb. 4, 2025 09:08:43
Graham Thompson, Technical Artist @ Rockstar Games