Add helpers for working with external files and docs
This commit is contained in:
parent
9d9fd57fe6
commit
7dc083e361
10 changed files with 114 additions and 4 deletions
11
external.py
Normal file
11
external.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import bpy
|
||||
import os
|
||||
|
||||
def load(filename):
|
||||
"""
|
||||
Execute an external script.
|
||||
"""
|
||||
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)
|
||||
Reference in a new issue