How to load plugins as objects?

censored censored at dontemailme.com
Sat May 28 05:11:46 EDT 2005


Hi. I'm hoping for a bit of programming guidance here ....

I have an application I wrote (it's an irc bot fyi), with which I want to
use plugins. 

Basically, I want there to be directory called plugins/ . 

In plugins, there should be a bunch of *.py files. Each file should
contain a single class.

When the application launches, I want the interpreter to scan the
plugins/ dir for *.py files, and load each class in each every *.py file
as an object an object in memory. 

I want it to so that every time I want the app to perform a new function,
I just write a plugin and stick it in the plugins/ directory.

What's the easiest way to go about this?



More information about the Python-list mailing list