I have the following situation. I have a class (let's call it GeometryCalculator) with many functions which I would like to reuse between a few addons. How can I do it in a way that the GeometryCalculator is a part of each addon. If a user has 5 addons installed and then he uninstalls any of them the rest of addons can still use this common class. Should all addons have a copy of the GeometryCalculator class in their folder? Any ideas how to do it are welcome. Are there any guidelines how this should be tackled? Thanks in advance.
Inside your scripts folder you have
addons and maybe
addons_contrib and a
The modules folder can added if it's not there and used to store files that you want to access from various add-ons. In this case I have a file which stores functions, but it could store classes (anything a .py file is used for).
Imagine the modules folder has a folder inside called 'some_name',
and some_name contains a python file called functions,
so the path is
scripts/modules/some_name/functions.py . To import that module in an addon you write
from some_name import functions
Potentially this makes installing your add-on a little bit more involved for the average novice user, unless you write code that places the files in the modules folder automatically