faqts : Computers : Programming : Languages : Python

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 11 people (64%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How to create a class instance of a class defined in another file that is not known in advance

Jan 11th, 2004 22:05
Khurram Ijaz, Gregor Leban,


Your module name is mymodule and class is myclass
import mymodule
myobj = mymodule.__dict__['myclass']( args_if_any)
Simple answer. I have used it and  it works.