public
Created

Dynamic imports

  • Download Gist
gistfile1.py
Python
1 2 3 4
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)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.