Created
October 3, 2012 11:41
-
-
Save tuimz/3826519 to your computer and use it in GitHub Desktop.
Dynamic imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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