Hello,
this commit should fix the ModuleNotFoundError issue -> #23.
Behaviour:
If an addon is initial created in the blender config path".../.config/blender/2.80/scripts/addons" and the blender start command is executed from visual studio code, blender can't load and enable the addon due to a ModuleNotFoundError exception.
If the blender start command is executed a second time, the addon can be loaded an no ModuleNotFoundError exception occurs.
Cause:
The module can't be loaded the first time because the ".../.config/blender/2.80/scripts/addons" path is not in the python module path so the list sys.path doesn't contain the addons path. I don't know why blender can't recognize the correct path the first time. One interesting thing to mention is, that the path ".../.config/blender/2.80/scripts/addons/modules" is included in sys.path. So the sub dir "modules" is included but not the parent "addons".
Solution:
To make sure the ".../.config/blender/2.80/scripts/addons" path is included in sys.path and the module can be loaded by blender, I add a condition in the setup_addon_links method. If the path doesn't exist, it is added to sys.path.
Hello, this commit should fix the ModuleNotFoundError issue -> #23.
Behaviour: If an addon is initial created in the blender config path
".../.config/blender/2.80/scripts/addons"
and the blender start command is executed from visual studio code, blender can't load and enable the addon due to aModuleNotFoundError
exception. If the blender start command is executed a second time, the addon can be loaded an noModuleNotFoundError
exception occurs.Cause: The module can't be loaded the first time because the
".../.config/blender/2.80/scripts/addons"
path is not in the python module path so the listsys.path
doesn't contain the addons path. I don't know why blender can't recognize the correct path the first time. One interesting thing to mention is, that the path".../.config/blender/2.80/scripts/addons/modules"
is included insys.path
. So the sub dir"modules"
is included but not the parent"addons"
.Solution: To make sure the
".../.config/blender/2.80/scripts/addons"
path is included insys.path
and the module can be loaded by blender, I add a condition in thesetup_addon_links
method. If the path doesn't exist, it is added tosys.path
.