def main(): m.f1() m.f2() m.f3() sys.exit()
import module1 print("We are executing module1 from here") print("__name__:") module1.f1()
""" 不同模块中调用相同名字的函数 Verison: 1.0 Author: 郑仁伟 Date: 2020-02-06 """ from module1 import foo foo() from module2 import foo foo() from module1 import foo as f1 from module2 import foo as f2 f2() f1()
import module1 print("module1.x : " + str(module1.x)) x = 4 y1 = module1.f1(x) y2 = module1.f2(x) print("module2 -> (x, y1, y2) : " + str((x, y1, y2)))