Skip to content

Instantly share code, notes, and snippets.

@mpurdon
Created March 17, 2015 02:12
Show Gist options
  • Save mpurdon/278467c510fb7447b30c to your computer and use it in GitHub Desktop.
Save mpurdon/278467c510fb7447b30c to your computer and use it in GitHub Desktop.
dynamic import
import importlib
mod = importlib.import_module('dir.mymodule')
MyClass = getattr(mod, 'MyClass')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment