Last active
October 18, 2022 21:55
-
-
Save eliemichel/9bbb87bf045c1bd38ab7a3d867450f42 to your computer and use it in GitHub Desktop.
Import a module from another text in the same .blend file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def local_import(module_name): | |
exec('\n'.join([l.body for l in bpy.data.texts[module_name].lines])) | |
for k, v in locals().items(): | |
globals()[k] = v | |
# Example | |
import bpy | |
import bmesh | |
import numpy as np | |
local_import('tiny_timer.py') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment