Plugins in Python

Lars Yencken lljy at students.cs.mu.oz.au
Fri Jun 28 00:26:06 EDT 2002


Erik Max Francis wrote:

> Lars Yencken wrote:
> 
>> I'm trying to do plugins for a program I'm writing in Python, and I'm
>> not
>> sure how exactly to do it. Basically what I want it to be able to
>> write a
>> module which loads every python file in a directory and stores an
>> instance
>> of each one that loaded successfully.
> 
> The most obvious implementation is simply to have them each imported as
> modules with __import__, and define some kind of simple
> initialization/shutdown API that will be called upon import.
> 

Thanks, it worked well to just use __import__ and have some standard module 
items.

Lars



More information about the Python-list mailing list