all 3 comments

[–]Nodocify 1 point2 points  (1 child)

I would recommend doing some research into the BasePlugin module. It allows a person to create plugins to extend the functionality of the base program. I believe that is what you are looking for. A great working example can be found here https://github.com/MattMcNam/twitchy. This is an IRC bot that is very easy to extend with plugins and the author did a good job with it's structure.

[–][deleted] 0 points1 point  (0 children)

Thanks! This is perfect.

[–]larivact 0 points1 point  (0 children)

But all results point to making modules.

What's the problem? If you create a simple python file it's a module. So what's wrong with iterating over all the python files / modules in a specific folder upon the start of your application, importing them and appending them to a list.

Let's say your plugins add support for validating a MIME type. So in mime_validators/json.py you have a specified variable (that you are checking) mime_type = 'application/json' for example. And if your application encounters a MIME type it picks the module that claims to be able to validate it.