Skip to content

Instantly share code, notes, and snippets.

@schmir
Created October 13, 2010 21:36
Show Gist options
  • Save schmir/624963 to your computer and use it in GitHub Desktop.
Save schmir/624963 to your computer and use it in GitHub Desktop.
diff --git a/apipkg.py b/apipkg.py
--- a/apipkg.py
+++ b/apipkg.py
@@ -30,7 +30,11 @@
def importobj(modpath, attrname):
module = __import__(modpath, None, None, ['__doc__'])
- return getattr(module, attrname)
+ attrs = attrname.split(".")
+ tmp = module
+ for x in attrs:
+ tmp = getattr(tmp, x)
+ return tmp
class ApiModule(ModuleType):
def __init__(self, name, importspec, implprefix=None, attr=None):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment