Jan-30-2018, 09:07 AM
(Jan-30-2018, 06:57 AM)Gribouillis Wrote: You can exec() the code in a dict and get the class as a value in the dict.
Thanks! Looks like what I need.
May I ask for more help? I'm trying to use following approach now
class_def = "class definition here" globs = {} exec(class_def, globs) c = globs["ClassName"]() # do something with cTo get class by name I parse
class_def
variable to extract class name. Is it possible to find class without knowing its name?