I am adapting my add-ons to Blender extensions. The add-ons are enabled and mostly work correctly, but I am no longer able to access the add-ons from scripts. My main add-on is called import_daz. After it has been enabled, the script
import import_daz
still fails because the import_daz module is not found. Extensions end up in the 4.2/extensions/user_default directory, but Blender doesn’t seem add it to the python paths.
Another thing: I have read that the bl_info dict in __init__.py should be removed, but when I do I cannot enable the add-on.
Thank you for this. I managed to import the module into a sister module at the same level, using
import ..import_daz
instead of
import import_daz
Or in a version-independent way:
if bpy.app.version < (4,2,0):
import import_daz
else:
import ..import_daz
That solves my most pressing concern. However, the original problem how to import the module into a script remains, especially if the blend file isn’t saved so the __package__ variable is not set.