1 2 3 4 5 | def dynamic_import( path ):
l = path.rfind('.')
parent, child = path[:l], path[l+1:]
base = __import__(parent, globals(), globals(), [child])
return getattr(base, child, None)
|
More like this
- Humanize lists of strings in templates by ChipX86 6 years ago
- Unfuddle-style post-commit emails - tied to a specific Django project. by jsandell 4 years, 9 months ago
- Digg Style URL String Parser by addicted 6 years, 2 months ago
- Dynamic import from an installed app by Archatas 4 years, 2 months ago
- Download images as png or pdf by gkelly 6 years, 2 months ago
Comments
Looks great for plugins!
#