= Session independent scripts = You can create a Python file that is always invoked whenever Houdini starts up. You might use this file to define helpful Python functions; create aliases for hou module classes, functions, and methods; or otherwise customize Houdini. Houdini will search in `$HOUDINI_SCRIPT_PATH` for files named `python/pythonrc.py` or `python/.pythonrc.py`. For example, if you want to create such a file that is customed for you, you would put it in `$HOME/houdini/scripts/python/pythonrc.py`. Similarly, you could put the file in $HSITE to have a site or project-wide configuration script. Note that you can use pythonrc.py to add code to the hou.session module with [Hom:hou.appendSessionModuleSource]. Do not assign directly to hou.session (for example, don't write hou.session.x = ...), because attributes you assign directly to hou.session will not be saved with the hip file. Houdini also supports Python versions of 123.cmd and 456.cmd, named 123.py and 456.py, respectively. Like 123.cmd, 123.py is invoked only when Houdini is started without a hip file. 456.py is invoked using the same rules as 456.cmd: Houdini runs it each time a file is loaded or the session is cleared. Note that Houdini will run all the pythonrc.py files it finds in the path, but it will only run the first 123.py file in the path. Also, if 123.cmd and 123.py both exist, Houdini will only run 123.py. You can run Python files in `$HOUDINI_PATH` with `execfile(hou.findFile("yourfile.py"))`. If you want to run code that's in an opdef: path, you can use `eval(compile(hou.readFile("opdef:Object/myobject?section")))`. A good way of running your Python code is to import it as a module. Houdini will automatically append all the directories in `$HOUDINI_SCRIPT_PATH` named `scripts/python` to sys.path. So, if the module is in `$HOME/houdini9.0/scripts/python/yourmodule.py`, you can run `import yourmodule`. If the path to the file is not already in sys.path, you'll need to add it there manually or set `$PYTHONPATH` before you import it. To access Python variables in the global scope from hou.session, import __main__. For example, if x is a variable in the global scope, you can access it via __main__.x. You can use this approach to access Python global variables from parameter expressions, HDA Python modules, Python button callbacks, shelf scripts, etc.