We have several .blends that have multiple embedded python scripts for doing various tasks. Prior to April 2019 builds of 2.80 we never had issues loading this scripts. Now, however, the way in which these scripts are loaded has changed.
Let’s say we have 2 scripts in blender. One is called
first.py and the other is called
second.py. In previous versions of 2.80 we would open our .blend and “Run Script” on
first.py. It has the following:
import second second.func()
This worked great. Post April 2019 versions of 2.80 started failing with
Traceback (most recent call last): File "J:\script_example.blend\first.py", line 1, in <module> ModuleNotFoundError: No module named 'second' Error: Python script failed, check the message in the system console
After some digging around we discovered that this feature we relied on was changed: PyAPI: remove support for importing text blocks as modules
So now, we’ve modified our .blend scripts to the following:
import bpy second = bpy.data.texts["second.py"].as_module() second.func()
This is not a huge change, but I thought I’d put it in a post here so that if others are having the same issue they won’t have to spend a few hours trying to find a workaround.