I'm trying to access some code in an addon that ships with blender (bool tools and extra objects) and I want to be able to automatically import the code I need without having to make the user enable the addons manually. I know if I can find the name of the package I can import it but I can't seem to find the name of the package. Thank you!!


1 Answer 1


Addons are modules

In blender the addons folders are added to the system path. Addons are imported as modules.

The preferences displays the path, hence for "Bool Tools"

enter image description here

its the name of the py file object_boolean_tools and for Add Mesh Extra Objects,

enter image description here

the name of the folder containing the __init__.py file. (add_mesh_extra_objects) Standard python module "stuff".

To import the bool tools module:

>>> import object_boolean_tools
>>> object_boolean_tools.

to import a method from it, etc

from object_boolean_tools import update_panels

Enable the addon

To enable an addon without the user having to do it manually, recommend usage of the Addon Utilities module. Consult the docs. eg there is an option in the enable method to pass an error handler. A simple example of usage, check if the addon is enabled, if not enable it. Could flag its enabling in register and if-so disable in unregister.

>>> from addon_utils import enable, check

>>> loaded_default, loaded_status = check("add_mesh_extra_objects")
>>> if not loaded_status:
...     enable("add_mesh_extra_objects")
<module 'add_mesh_extra_objects' from '/home/batfinger/blender-git/xxx/bin/2.91/scripts/addons/add_mesh_extra_objects/__init__.py'>

Note on my system the boolean tools addon does not register.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.