Skip to content

Instantly share code, notes, and snippets.

@eliemichel
Last active October 18, 2022 21:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save eliemichel/9bbb87bf045c1bd38ab7a3d867450f42 to your computer and use it in GitHub Desktop.
Import a module from another text in the same .blend file
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