Autoload in Python
In the past I've used perl's AUTOLOAD facility for implementing lazy loading of symbols into a namespace, and wanted the same functionality in python. Traditionally the closest you appear to be able to get is to use a class and a __getattr__ class to achieve this sort of thing. However I've also tried rummaging around in sys.modules , and come up with this: # mymod.py def greet(greeting="Hello World"): print greeting class autoload(object): def __init__(self, __name__): super(autoload, self).__init__() self.wrapped_name = __name__ self.wrapped = sys.modules[__name__] def __getattr__(self, name