Best practices for dynamically loading plugins at startup

Christoph Haas email at christoph-haas.de
Mon Sep 26 16:34:43 EDT 2005


On Sun, Sep 25, 2005 at 11:33:03PM -0400, Jeff Schwab wrote:
> I recently came up against this exact problem.  My preference is to have 
> the plugin writer call a method to register the plugins, as this allows 
> him the most control.  Something along these lines:
> 
> 	class A_plugin(Plugin):
> 		...
> 
> 	class Another_plugin(Plugin):
> 		...
> 
> 	register( A_plugin )
> 	register( Another_plugin, optional_custom_registration_parameters )

I like the idea. And "supybot" seems to do just that. What would the
"def register:" do? Maintain a global list of registered plugins?
I didn't like the idea of having global variables. Or would register
be a method of some "main" class? How would I access that?

Thanks to everybody else who posted ideas on my problem. I'm trying
all the proposals to get an idea of which approach works best.

Regards
 Christoph
-- 
~
~
~
".signature" [Modified] 3 lines --100%--                3,41         All



More information about the Python-list mailing list