import sys from twisted internet interfaces import IAddress name twist

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import sys
#from twisted.internet.interfaces import IAddress
name = 'twisted.internet.interfaces.IAddress'
def import_class(line):
line = line.split('.')
mname = '.'.join(line[:-1])
if mname in sys.modules:
mname = sys.modules[mname]
else:
__import__(mname)
mname = sys.modules[mname]
return getattr(mname,line[-1])
print import_class(name)