I am working on an HDA and would like to have my python code in an external file (not only save it in the python modules inside the HDA). I then just create functions that call the actual functions inside that module. However, when altering the contents of an external module, it does not update the one the HDA is referencing. I assume this is because Houdini loads the modules in Python path on startup. Is there a way that I can manually force re-importing/sourcing the external python modules in my custom python path? This way I can just work in VSCode -> source/import the changes -> test the HDA.
Cheers!
re-loading python module in HDA
2606 2 2-
- Robbert
- Member
- 55 posts
- Joined: Feb. 2017
- Offline
-
- Andr
- Member
- 899 posts
- Joined: Feb. 2016
- Offline
if you load the module in the "Extra Files" section of the Type Properties window of you HDA, you have the RELOAD ALL FILEs button.
I assume then you should be able to refer to that module from the Python module, but I don't know how, I never use this workflow.
I assume then you should be able to refer to that module from the Python module, but I don't know how, I never use this workflow.
Edited by Andr - Oct. 17, 2022 05:45:35
-
- Robbert
- Member
- 55 posts
- Joined: Feb. 2017
- Offline
Andr
if you load the module in the "Extra Files" section of the Type Properties window of you HDA, you have the RELOAD ALL FILEs button.
I assume then you should be able to refer to that module from the Python module, but I don't know how, I never use this workflow.
Hey, Thanks for this answer! I checked it out and it does you are able to include external files, however it does so by actually pointing it to the file name. I would like to avoid direct-linking so that the HDA can be distributed easily to other computers (which have the same PYTHONPATH). For now I settled with;
import importlib importlid.reload(module_name)
This seems to at least reload by module name every time I click apply/accept on the HDA parameter window.
Cheers!
Technical VFX artist @ Housemarque / Sony Interactive Entertainment
-
- Quick Links

