import module
my_stuff = module.__dict__
Note that this dict is the actual dict the module uses to hold its attributes. If you do my_stuff['foo'] = 3
, module
has a new foo
attribute equal to 3
.
If you just want to get attributes by names determined at runtime, you don't really need the dict. You could do
thing = getattr(module, thingname)