just downloaded todays Blender 2.8 build and it seems I can no longer import a function from another Textblock. Works well on a build from April 5th (haven't updated since then).

This simple example is not working in todays build:

import module broken


Solved: there was an API change. Thanks to @alyawn for posting the solution here

This is how it works now: enter image description here

something = bpy.data.texts['something.py'].as_module()
  • $\begingroup$ I can't figure out how to do a "from mymodule import *", so I don't have to write the module name before every function. $\endgroup$ – Tortenrandband Dec 18 '20 at 22:44
  • 1
    $\begingroup$ @Tortenrandband globals().update(bpy.data.texts['something.py'].as_module().__dict__) $\endgroup$ – Mark K Cowan Mar 2 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.