diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-27 09:04:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-27 09:04:59 +0300 |
commit | 6021cc4007dacce541be75b62c35508a2679ab10 (patch) | |
tree | 48507018addf19276be1f9196534ddc14e871997 /release/scripts/templates_py/external_script_stub.py | |
parent | 5181f085eb67a8ea2e0c4009adbbe5ae82b61919 (diff) |
Rename script stub
Was clear from name this is to run external scripts.
Diffstat (limited to 'release/scripts/templates_py/external_script_stub.py')
-rw-r--r-- | release/scripts/templates_py/external_script_stub.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/release/scripts/templates_py/external_script_stub.py b/release/scripts/templates_py/external_script_stub.py new file mode 100644 index 00000000000..5505ca64078 --- /dev/null +++ b/release/scripts/templates_py/external_script_stub.py @@ -0,0 +1,13 @@ +# 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__"} +with open(filepath, 'rb') as file: + exec(compile(file.read(), filepath, 'exec'), global_namespace) |