Skip to content

Instantly share code, notes, and snippets.

@tuimz
Created October 3, 2012 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuimz/3826519 to your computer and use it in GitHub Desktop.
Save tuimz/3826519 to your computer and use it in GitHub Desktop.
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