Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Dynamic imports
def __get_module(self, modulename):
"""Dynamically get the proper module to call methods on"""
imported_module = __import__('myapp.modules', fromlist=['myapp.modules'])
return getattr(imported_module, modulename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment