I am an experienced python programmer, but just getting into the Blender API. I am stuck on trying to get a script to execute when the Blender file is loaded. I want to do all sorts of setup in this script, but to start with, I'm just trying to change the python path to add my working directory, so that .py files can be imported from there.
So, I opened a text editor window in a fresh project, then created a new text block, into which I typed the following 2 lines:
import sys
sys.path.append('/Path/To/My/Blender/Project')
When I use the "run script" button, and check sys.path in the console, my path has indeed been added.
So then, I checked the register toggle for the text block, and set the user preferences to auto run python scripts. I saved the .blend file, exited Blender, and re-started by double clicking the .blend file.
When I check sys.path
, it is the normal blender path, but if I then run the script that should have auto run, sys.path changes as it should. So it would seem that my script is not running on load.
I am on Xubuntu 14.04 (Trusty) and my Blender version is 2.78. I must be making some really simple mistake, but I can't seem to find it. Thanks for any suggestions.