Allenfenqu/script1.py

9 lines
232 B
Python
Raw Permalink Normal View History

2024-03-20 12:25:06 +08:00
import script2 # 导入脚本2不会执行 script2.py 中的顶层代码
def main():
print("Main function in script1")
if __name__ == '__main__':
print("This code is executed when script1 is run directly.")
main()