Python plugins

laotseu bdesth at nospam.free.fr
Sun Sep 8 23:21:23 EDT 2002


Tobias Klausmann wrote:
> Hi there,
> 
> For an open source project that needs to be extensible by its
> users, I would like to create a plugin architecture. Mind you,
> I'm not trying to use Python as a plugin language only like XChat
> or Gnumeric do. Let me illustrate:

[snip]

> But now I have two
> problems: first, I have no idea how to call, say
> pi.someplugin.dostuff(args) except constructing each and every
> call as a string and exec() it - which is both error-prone and
> awkward IMHO.


Just a snippet without any other testing code or whatsoever...

module[index] = __import__(module_name, globals(), locals(), [])
(...)
module[index].dostuff(args)

HTH
laotseu




More information about the Python-list mailing list