L
Lars Heuer
Hi all,
I try to do the following:
map = {'some.thing':'ClassName'}
try:
mod = __import___(map.keys()[0], {}, {}, map.values()[0])
# Now I want to return an instance of the class in
# map.values()[0]
# I've to do something like "return mod.(map.values()[0])()"
How to return the instance of the 'unknown' class? I've only the name
as string. I tried eval, but I don't get it work.
Thanks,
Lars
I try to do the following:
map = {'some.thing':'ClassName'}
try:
mod = __import___(map.keys()[0], {}, {}, map.values()[0])
# Now I want to return an instance of the class in
# map.values()[0]
# I've to do something like "return mod.(map.values()[0])()"
How to return the instance of the 'unknown' class? I've only the name
as string. I tried eval, but I don't get it work.
Thanks,
Lars