Gimp-Forum.net

Full Version: Load multiple plugins from a parent plugin folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Let say I want to have a folder containing my plugin. As I understand, GIMP only looks for plugins file named as the folder. For example, this works ok:

Code:
my-plugin-folder-name
    my-plugin-folder-name.py

If I change the plugin file name, the plugin will not be loaded. For example:

Code:
my-plugin-folder-name
    something-different.py

In this case the file something-different.py will not be loaded by GIMP, even if it's set to be executable.

Is it possible to force GIMP (from settings) to also look for other file names into plugin subfolders? Ideally, I would like to have multiple files for slightly different plugins into the folder my-plugin-folder-name. Right now with only one file to be loaded, as my plugin get bigger and bigger, it's becoming also messier to keep it "organized"...
IMHO your best course of action is to have one file containing the registration of all the plugins. The plugin code then mostly imports your other files as python modules. To do so you have to extend the Pyhon path to add the directory where the modules are, which is the directory where your "main"/registration file is. This one can retrieve its location as os.path.abspath(sys.argv[0]). You can also have your functions in the main with one or more python modules for the "ancillaries", or even have one module per function, and all the modules sharing a common "library" module.

Edit: attached ZIP with proof-of-concept code.

Edit2: For completeness, proof-of-concept is now a main that calls modules that call a common library
It worked!!! Thank you! Smile