Skip to content

Instantly share code, notes, and snippets.

@elishowk
Created December 10, 2010 10:27
Show Gist options
  • Save elishowk/736062 to your computer and use it in GitHub Desktop.
Save elishowk/736062 to your computer and use it in GitHub Desktop.
dynamically gets a class given its name and the name of its module
def dynamic_get_class(mod_name, class_name):
"""returns a class given its name"""
mod = __import__(mod_name, globals(), locals(), [class_name])
return getattr(mod, class_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment