[Tutor] conditional import

Jörg Wölke lumbricus@gmx.net
Thu, 8 Mar 2001 04:53:12 +0100 (MET)


Hello!!!

is there a way to import a module conditionally.
I have (roughly) something like this:

def print_dict(modul):
	import modul           # here comes the error: no module
	print modul.__dict__   # named modul 

def main():
	mod=raw_input("Enter module name\n> ")
	print_dict(mod)

###########################
of course theres no module named modul but 
shouldn't it replace modul with the result from
raw_input() ????
what am i missing?

TIA n' Grrreetz Jö!

-- 
Sent through GMX FreeMail - http://www.gmx.net