6
$\begingroup$

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

$\endgroup$

1 Answer 1

9
$\begingroup$

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()
$\endgroup$
2
  • $\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$ Dec 18, 2020 at 22:44
  • 1
    $\begingroup$ @Tortenrandband globals().update(bpy.data.texts['something.py'].as_module().__dict__) $\endgroup$ Mar 2, 2021 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .