I want to modify the init.py located at Blender\2.72\scripts\startup\bl_ui so it can load some scripts of mine. I would like to add my script in this list “_modules” but I could not figure out how to do this.
Currently I have added the classic scriptstub (located at the script examples) and it works fine. However I would be interested to integrate it with the Blender’s mechanism.
# def load_custom():
# import bpy
# import os
# name = "myscript.py"
# path = "C:\\mypath\\"
# filepath = os.path.join(os.path.dirname(path), name)
# global_namespace = {"__file__": filepath, "__name__": "__main__"}
# with open(filepath, 'rb') as file:
# exec(compile(file.read(), filepath, 'exec'), global_namespace)
# load_custom()
If you might wonder why I want to do this, I found that a good way to use the scripts while in development mode. This way I can keep my development file system intact (e.g. folder categories, git) while letting Blender load it on the fly.