# How to load scripts into the Text Editor on startup?

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?

• How do you load the script on startup? Jun 28 '19 at 19:27
• I placed the script in my User path startup scripts directory. Its the default scripts path in /User/Library/Application Support/ . So maybe its being run too early in the startup process? Should I place it in the alternate user defined startup path? Jun 28 '19 at 19:55
• And what is the error that you get? Jun 28 '19 at 20:49
• No meaningful error message. In the startup Terminal it just prints.. File "/Users/my_name/Library/Application Support/Blender/2.80/scripts/startup/import_scripts.py", line 7, in <module> bpy.ops.text.open(filepath="/Users/my_name/Documents/Blender/scripts/modules/Camera_mover.py"). It just identifies the first line in the script, but doesn't indicate what the specific problem is. Jun 28 '19 at 21:15
• Try loading your script file from the command line: blender --python path/to/import_scripts.py Jun 29 '19 at 18:20

import bpy