我正在尝试从另一个文件(例如,test.py)执行脚本(例如,main.py),我不想调用main的任何函数,而是我想开始执行来自if __name__=="__main__":
例:
test.py
def funA():
....
def funB():
....
#the last function of file
def funC():
#here i want to start executing main.py without calling any function.
main.py
def fun_x(arg1):
#do something
if __name__ == "__main__": #execution starts here
arg1=10
x(arg1)
是否可以像这样直接打电话给主?