Supply a plugin interface

Aahz aahz at pythoncraft.com
Thu Apr 23 12:16:31 EDT 2009


In article <75akp8F17g294U1 at mid.dfncis.de>,
Johannes Bauer  <dfnsonfsduifb at gmx.de> wrote:
>
>the GUI application should now browse the plugin directory and read
>those plugin python files and somehow incorporate (i.e. discover what
>modules are there, instanciate, etc.)
>
>How do I do that at runtime with Python?

You might consider using execfile() but probably __import__ works better
for your purposes.  There's also importlib on PyPI, which is the backport
from 2.7.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list