9 lines
232 B
Python
9 lines
232 B
Python
|
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()
|