How can I make a script run when I open a file? This to be used with registering an handler every time the file is opened.
If the file is a .blend you can use an application handler
import bpy from bpy.app.handlers import persistent @persistent def load_handler(dummy): print("Load Handler:", bpy.data.filepath) bpy.app.handlers.load_post.append(load_handler)
For other file types there is no callback provided, you could iterate over all text files
for t in bpy.data.texts: 'check for previously created' -> exec if new and add to list.
and check for new entries triggered by a timer.