[EMAIL PROTECTED] wrote: >Its the Java developer again... > >I'm working on an application framework that I would like to implement >in Python. Part of the application framework is a plug-in model that is >similar to the one used in Eclipse. > >Is it possible to load and use "modules" containing plug-in code >written by third party developers into a running instance of the >framework? How would I do this? Do I need to "dynamically load" the >module at runtime? (I will scan a folder in the application direcotry >for XML files containing information about the plug-ins, including the >modules that implement them.) > >Thanks, > >Scott Huey > > > Look at the "imp" module.
Any module can be imported at any time in your code. The import statement is usually used to the top of a file, making it *look* like a declaration, but in fact it may be executed anywhere. The import statements does, however, hard code its module's name. For a plugin system, you'll probably want to import a module given a string containing its name. The "imp" module provides this as well as access to many of the features of the import mechanism. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list