Python class objects as plugins?

sleem haha at asifIdgiveoutmyemail.com
Mon Aug 14 22:04:35 EDT 2006


Hi. I'm hacking up an irc bot in python using Joel Rosdahl's irclib.

I want to be able to add plugins to my bot, without having to restart it.

In specific, I would have a directory called "plugins". Into this, I would
place scripts that the bot could load as plugins, whenever I give it the
instruction to "rehash".

I figured the most practical way to do this, is to have each plugin script
file basically contain a class that the program can load as an object. 

So I need a subroutine that can import all the classes in the plugins/
directory at start up. When instructed to rehash, it also needs to be able
to destroy all the objects it currently has in memory, and reload all the
class files in the plugins/ directory.

What's the most practical way to do this? 

Thanks in advance.  



More information about the Python-list mailing list