Re: Best practices for dynamically loading plugins at startup

2005-09-26 Thread Jeff Schwab
Christoph Haas wrote: > 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: >> >>

Re: Best practices for dynamically loading plugins at startup

2005-09-26 Thread Christoph Haas
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)

Re: Best practices for dynamically loading plugins at startup

2005-09-26 Thread Jack Diederich
On Sun, Sep 25, 2005 at 11:24:04PM +0200, Christoph Haas wrote: > Dear coders... > > I'm working on an application that is supposed to support "plugins". > The idea is to use the plugins as packages like this: > > Plugins/ > __init__.py > Plugin1.py > Plugin2.py > Plugin3.py > > When the

Re: Best practices for dynamically loading plugins at startup

2005-09-25 Thread beza1e1
I wrote this one: -- def load_plugin(self, plugin, paths): import imp # check if we haven't loaded it already try: return sys.modules[plugin] except KeyError: pass # ok, the load it fp, filen

Re: Best practices for dynamically loading plugins at startup

2005-09-25 Thread Jeff Schwab
Christoph Haas wrote: > Dear coders... > > I'm working on an application that is supposed to support "plugins". > The idea is to use the plugins as packages like this: > > Plugins/ > __init__.py > Plugin1.py > Plugin2.py > Plugin3.py > > When the application starts up I want to have thes

Re: Best practices for dynamically loading plugins at startup

2005-09-25 Thread Jarek Zgoda
Christoph Haas napisaƂ(a): > Since I don't know which plugins have been put into that directory > I cannot just "import Plugin1, Plugin2, Plugin3" in the "__init__.py". > So I need to find out the *.py there and load them during startup. > I could do that with a "walk" over that directory. See en

Best practices for dynamically loading plugins at startup

2005-09-25 Thread Christoph Haas
Dear coders... I'm working on an application that is supposed to support "plugins". The idea is to use the plugins as packages like this: Plugins/ __init__.py Plugin1.py Plugin2.py Plugin3.py When the application starts up I want to have these modules loaded dynamically. Users can put th