hou.allowEnvironmentToOverwriteVariable
function
Allow (or disallow) an environment variable to overwrite the value of a global variable saved in a hip file.
Usage
allowEnvironmentToOverwriteVariable(name, onoff)
Note that you need to allow the variable to be overwritten from within Houdini/hython before loading in the hip file.
For example, suppose you set the JOB environment variable to /home/john/dyproject and created a hip file in /home/john/myproject/hip/scene.hip. Your hip file could then reference files using a $JOB prefix. If you then moved your project to /mnt/projects/myproject you cannot simply change the JOB environment variable because Houdini saved the old value of $JOB to the hip file. This function lets you override the value of $JOB before you load the hip file, as follows:
import os os.environ["JOB"] = "/mnt/projects/myproject" hou.allowEnvironmentVariableToOverwriteVariable("JOB", True) hou.hipFile.load(os.path.expandvars("$JOB/hip/scene.hip"))