__import__('x.y.z') returns module 'x'; how do I get z?
Try:
__import__('x.y.z').y.zFor more realistic situations, you may have to do something like
m = __import__(s) for i in s.split(".")[1:]: m = getattr(m, i)
CATEGORY: programming
This is an old copy of the Python FAQ. The information here may be outdated.
Try:
__import__('x.y.z').y.zFor more realistic situations, you may have to do something like
m = __import__(s) for i in s.split(".")[1:]: m = getattr(m, i)
CATEGORY: programming
rendered by a django application. hosted by webfaction.