Plugins for a Python program

John Nagle nagle at animats.com
Sun Sep 27 02:20:24 EDT 2009


OldAl wrote:
> I am impressed with Bazaar's implementation of plugins: a Python
> plugin is simply copied to a ./bazaar/plugin/<my-plugin> directory and
> the plugin is recognized by Bazaar and can be run from CLI as:
> 
> bzr <my-plugin>
> 
> I would like to implement something similar in my Finite Element
> Method program, so that any user can write certain element properties
> (in a predetermined format) to use with the program.

    CPython can execute "import" operations at run time.  The form is

	s = "modulename"
	X = __import__(s)

So you can load plug-ins from within your running program.

					John Nagle



More information about the Python-list mailing list