Dynamic loading of modules
henrik.motakef at web.de
Mon Sep 23 15:33:21 EDT 2002
"Andreas Lydersen" <al at metroic.no> writes:
> 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:
__import__ doesn't really import the module, it returns a module
object. So do something like
>>> pwd = __import__("plugins.Password")
More information about the Python-list