Possible Duplicate:
Dynamic loading of python modules
python: How to add property to a class dynamically?
I have a dictionary with the filename and class names how can I import this class names and how can I create this classes?
Example:
classNames = { 'MCTest':MCTestClass}
I want to import the MCTest and create the MCTestClass.
You have to use the
__import__function:http://docs.python.org/library/functions.html#import
Example from doc page:
To instantiate a class from baz you should be able to do: