m = __import__(S)
try:
    attrlist = m.__all__
except AttributeError:
    attrlist = dir(m)
for attr in attrlist:
    globals()[attr] = getattr(m, attr)
How does one do the equivalent of "import * from module" with Python's __import__ function?