diff options
Diffstat (limited to 'release/scripts/templates_py/script_stub.py')
-rw-r--r-- | release/scripts/templates_py/script_stub.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/release/scripts/templates_py/script_stub.py b/release/scripts/templates_py/script_stub.py new file mode 100644 index 00000000000..44c7b802e2c --- /dev/null +++ b/release/scripts/templates_py/script_stub.py @@ -0,0 +1,14 @@ +# This stub runs a python script relative to the currently open +# blend file, useful when editing scripts externally. + +import bpy +import os + +# Use your own script name here: +filename = "my_script.py" + +filepath = os.path.join(os.path.dirname(bpy.data.filepath), filename) +global_namespace = {"__file__": filepath, "__name__": "__main__"} +file = open(filepath, 'rb') +exec(compile(file.read(), filepath, 'exec'), global_namespace) +file.close() |