importpkg.modprint(pkg.__name__)print(pkg.mod.__name__)print(pkg.mod.foo())# Import 2nd time, must be same module objectspkg_=__import__("pkg.mod")print(pkg_isnotpkg.mod)print(pkg_ispkg)print(pkg_.modispkg.mod)# import using "as"importpkg.modasmmprint(mmispkg.mod)print(mm.foo())