First…I brought up my old file and I realized I missed telling you a step.
After you add your file in the pre-flight you will then need to select the directory that contains the file you need to include and click on “Add Root Variable”.
As for
"Then you can put in the Environment variable that your hip file uses to refer to the ‘external’ file.
Maybe I shouldn't have mentioned that, since I don't know the context of the files you need to include. Since the add file and add root is maybe all you need to do.
I had two different cases. I'll just explain one of them involving Python.
In the Python Source Editor of my hip file I was referencing an external file that contained python functions I had written.
In order to use those functions, in the Python Source Editor I had to place the following:
import sys
sys.path.append("C:\Users\Me\Documents\Houdini Projects\Python Functions")
import MyFile_that_has_the_functions
...
...
And as is, for me to use it on my machine doing all my rendering localy - It's fine and works as is.
So for GM…
in order to include ‘MyFile_that_has_the_functions’ in the pre-flight…
I did addfile, selected the directory and did add root.
Then in pre-flight I gave the Environment Variable name of $MY_PYTHON.
Then saving and closing pre-flight, that Environment variable was added to my hip file.
And going to ‘Aliases and Variables’ under Edit tab of hip file, and in that under the variables tab can be found the new Environment Variable in my hip file:
MY_PYTHON C:\Users\Me\Documents\Houdini Projects\Python Functions
But in order for it to all work I had to go back to the Python Source Editor and change it to:
import sys
sys.path.append( hou.expandString("$MY_PYTHON") )
import MyFile_that_has_the_functions
...
...
Because when the server starts to render and sees $MY_PYTHON it knows to use “my_python”
( “my_python” being what the pre-flight created after I typed MY_PYTHON, which you see happens when you do add root part of the process )
which resides on the server and is pointing to the file on the server; Otherwise leaving my hip with:
sys.path.append("C:\Users\Me\Documents\Houdini Projects\Python Functions")]
That hip file on the server will try to look on my local disk, so it won't work.
It's like the whole process is trying to set up what you have locally and duplicate it on the server side.
I'm probably not explaining it technically correct, but hopefully you get a general idea - if I haven't created more confusion.