blender/release/scripts/templates/script_stub.py

13 lines
410 B
Python
Raw Normal View History

# 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__"}
exec(compile(open(filepath).read(), filepath, 'exec'), global_namespace)