1import pkg.mod 2 3print(pkg.__name__) 4print(pkg.mod.__name__) 5print(pkg.mod.foo()) 6 7# Import 2nd time, must be same module objects 8pkg_ = __import__("pkg.mod") 9print(pkg_ is not pkg.mod) 10print(pkg_ is pkg) 11print(pkg_.mod is pkg.mod) 12 13# import using "as" 14import pkg.mod as mm 15 16print(mm is pkg.mod) 17print(mm.foo()) 18