Cleanup: use staticmethod where appropriate
[blender.git] / release / scripts / templates_py / external_script_stub.py
1 # This stub runs a python script relative to the currently open
2 # blend file, useful when editing scripts externally.
3
4 import bpy
5 import os
6
7 # Use your own script name here:
8 filename = "my_script.py"
9
10 filepath = os.path.join(os.path.dirname(bpy.data.filepath), filename)
11 global_namespace = {"__file__": filepath, "__name__": "__main__"}
12 with open(filepath, 'rb') as file:
13     exec(compile(file.read(), filepath, 'exec'), global_namespace)