I am trying to load a couple of simple python scripts on startup for later use. 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 have a simple script that loads 2 scripts from a file path. 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. This is on Mac OS. Here is the script...
import bpy
bpy.ops.text.open(filepath="/Users/my_name/Documents/Blender/scripts/modules/Script1.py")
bpy.ops.text.open(filepath="/Users/my_name/Documents/Blender/scripts/modules/Script2.py")
This script is in my startup scripts directory, and does not execute but errors on the first line after the import bpy. I want the 2 scripts in the file paths to appear in the Text Editor after Blender loads. 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. But they will not load if I try to run this code at startup.
What is different when running this code on startup, from running it after startup?
blender --python path/to/import_scripts.py
$\endgroup$