Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #23 ModuleNotFoundError #42


Copy link

commented Jul 12, 2019

this commit should fix the ModuleNotFoundError issue -> #23.

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.

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".

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.

Add check if user_addon_directory is in python sys path so the addon …
…could be loaded as module and enabled in blender.

@JacquesLucke JacquesLucke merged commit da8d140 into JacquesLucke:master Jul 12, 2019


This comment has been minimized.

Copy link

commented Jul 12, 2019

Thank you :)

@schlegel11 schlegel11 referenced this pull request Jul 12, 2019


ModuleNotFoundError #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.