Plugins in Python

Benjamin Schollnick junkster at
Tue Jun 12 20:06:15 EDT 2001

In article <u7kyh46w7.fsf at>,
 David Bolen <db3l at> wrote:

> One approach is that the __init__ file in the package can inspect the
> package directory for other modules, and then use __import__ to import
> them.  I normally then populate a well-known dictionary within the
> __init__ module that applications can use to determine what plugins
> were loaded.  You can also decide to set up the modules for lazy
> loading using a proxy class if you want to avoid the overhead of
> actually importing the plugin until needed.
> Note that one major negative with this approach is that it confuses
> Python installation tools like py2exe and installer, as they can't
> follow the dynamic importing, and also because the directory structure
> may not be similar during execution.

Now, I haven't checked this out too throughly, but I've built a server
structure that uses standard EXEC calls to load additional plugins, and 
I don't remember seeing any problems with the installer......

Now it's been a while since I've modified it and tested it, so I maybe 
misremembering the situation....

      - Benjamin

More information about the Python-list mailing list