import modules at runtime

Manus Hand mjhand at
Mon May 8 21:34:55 CEST 2000

I regularly do the following, after dynamically realizing that "object"
should be an instance of a particular "className" found in a certain

code = __import__(moduleName)
object = code.__dict__[className](initParam1, initParam2, etc.)

Works like a charm.


More information about the Python-list mailing list