

Its just a convenient hack until a more elegant UI solution is invented by someone. It just won't work if the blender file is opened from within a different machine or file system. Then you only save these few lines in the Blender scene file and run it from the Text Editor, and the script is isolated from changes or prying eyes. A better method would be to save each script path in a run_script command as an individual text object. This is not quite a decent solution, since the entire script is saved within the blender file, which could add up to a lot of extra data, plus it exposes the script to unintentional changes. If you want specific scripts available for a specific scene, just open those scripts as data blocks for that scene and save it. Do this on the fresh Default Blender scene to open scripts in the default New Scene, then re-save the scene as Default. The solution is to open a script in Blender's Text Editor - this creates a text data block for the scene, which is saved with the scene. What is different when running this code on startup, from running it after startup? But they will not load if I try to run this code at startup.

I can run these 2 commands in the Python console, or run this script from the Text Editor, and the scripts will load in the Text Editor. I want the 2 scripts in the file paths to appear in the Text Editor after Blender loads. This script is in my startup scripts directory, and does not execute but errors on the first line after the import bpy.

import bpyīpy.(filepath="/Users/my_name/Documents/Blender/scripts/modules/Script1.py")īpy.(filepath="/Users/my_name/Documents/Blender/scripts/modules/Script2.py")

It works if I run the script from the text editor or from the Python console, but the script will not run if I try to load it on startup. I have a simple script that loads 2 scripts from a file path. I don't want to run the scripts on startup, I only want them available in the Text Editor so that I can quickly run them on demand, rather than search them out individually. I am trying to load a couple of simple python scripts on startup for later use.
