Hello,
I have a string which in reality is the name of a module to be
imported. The name of the class contained in the module also has the
same (although with different capitalization) . My requirement is to
import the module, and also create an instance of the class. eg:
str = "module" #name of module is "module.py"
cls = str.capitalize( ) #name of class is "Module"
inst = cls() #create an instance of class "Module"
how do i do this?
Thanks a lot in advance
I have a string which in reality is the name of a module to be
imported. The name of the class contained in the module also has the
same (although with different capitalization) . My requirement is to
import the module, and also create an instance of the class. eg:
str = "module" #name of module is "module.py"
cls = str.capitalize( ) #name of class is "Module"
inst = cls() #create an instance of class "Module"
how do i do this?
Thanks a lot in advance