importing module through variable

André Dahlqvist andre at beta.telenordia.se
Tue Jun 13 10:21:55 EDT 2000


> You want the __import__ function:
> 
> module = __import__(var)

I misphrased the question. Inside my module I have a dictionary that I
need to access. And the name of this dictionary is stored in a
variable. If I do:

import the_module

How can I then access the dictionary inside this module, if the name of
the dictionary is stored in a variable? Or is there some equivalence to
"from the_module import the_dictionary" when you're using __import__?
-- 

// André




More information about the Python-list mailing list