Add helpers for working with external files and docs

This commit is contained in:
Carson Katri 2022-11-13 18:49:09 -05:00
commit 7dc083e361
10 changed files with 114 additions and 4 deletions

11
external.py Normal file
View 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)