Skip to content

Instantly share code, notes, and snippets.

@rotaliator
Created August 31, 2018 22:09
Show Gist options
  • Save rotaliator/d80a0724c050c646f8b715b5bd2fe179 to your computer and use it in GitHub Desktop.
Save rotaliator/d80a0724c050c646f8b715b5bd2fe179 to your computer and use it in GitHub Desktop.
def _get_class(class_name):
parts = class_name.split(".")
module = ".".join(parts[:-1])
m = __import__(module)
for comp in parts[1:]:
m = getattr(m, comp)
return m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment