Dynamic loading of modules
dougfort at dougfort.net
Mon Sep 23 15:07:47 EDT 2002
On Mon, 23 September 2002, "Andreas Lydersen" wrote:
> I'd like to load a set of modules from a directory. I have tried to use the
> __import__(...) statement to do so, but with no success.
> The static approch works (of course), but the dynamic does not!
> import plugins.Password
> dynamic atttempt:
> I have tried 'exec "plugins.Password"', and that works. However, I
> get a list of pointers to the modules I import in order to work with them
> Bottom line is: I need to know how to dynamically load modules and get a
> pointer to the same module.
> Any help is appreciated.
Here's something my friend Joe found for a project we're working on
Regarding loading python "modules" from a directory... check out:
Title: Importing a dynamically generated module
Submitter: Anders Hammarquist (other recipes)
Last Updated: 2001/10/17
Version no: 1.0
Doug Fort <dougfort at dougfort.net>
More information about the Python-list