def function(): print("This is a module function") if __name__=="__main__": print("This is a script")
import qkt qkt.function()
结果:
>>> This is a module function >>>
2