Global python script

We’ve got several different plugins that all have repeating code. We’d like to create a utilities.py script that we can reference across the different plugins to cut down on repeating code.

Where would I need to put such a utiltiies file, and how would i reference it from each plugin? Or is this even possible?

Hi Jason and welcome,
That should get you going lib & bin

We’ll be testing that out today, but we have questions that the documentation doesn’t answer.

First, can we only do that at the panel level, or would it be possible to do it at the extension level.

Second, how should we write the import statement for those files?

You can do it pretty much at any level
Have a look at the pychilizer extension for example GitHub - dnenov/pyChilizer where it is done in the extension folder

You can do it at the tab, panel, pushbutton level. pretty much any level.
You may have to reload when making folder changes.

calling the colorize submodule from pychilizer looks like this
from pychilizer import colorize
and the lib folder looks like this https://github.com/dnenov/pyChilizer/tree/master/lib/pychilizer