Dynamic loading of modules
Andreas Lydersen
al at metroic.no
Mon Sep 23 14:54:44 EDT 2002
Hi,
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!
static:
import plugins.Password
dynamic atttempt:
__import__("plugins.Password")
I have tried 'exec "plugins.Password"', and that works. However, I need to
get a list of pointers to the modules I import in order to work with them
later.
Bottom line is: I need to know how to dynamically load modules and get a
pointer to the same module.
Any help is appreciated.
--
Johan Fredrik Øhman
More information about the Python-list
mailing list