Browse Source

add utils and dynamic_import function

pull/1/head
Brett Langdon 11 years ago
parent
commit
aafb04bb14
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      qw/utils.py

+ 7
- 0
qw/utils.py View File

@ -0,0 +1,7 @@
def dynamic_import(name):
module, _, function = name.rpartition(".")
mod = __import__(module, fromlist=[function])
components = name.split(".")
for comp in components[1:]:
mod = getattr(mod, comp)
return mod

Loading…
Cancel
Save