One python script run another python script

Method 1:

execfile('yourscript.py')

ref: https://www.edureka.co/community/50712/possible-call-one-python-script-from-another-python-script

by the way, you cannot use abc.py as filename, because when import abc, it will import unknown module

Using global variables between files?

ref: https://stackoverflow.com/questions/13034496/using-global-variables-between-files

Method 2: bash file

os.system('python yourscript.py')

by the way, you need to use python3 to run os.system 

ref: https://www.geeksforgeeks.org/how-to-run-bash-script-in-python/

ref: https://zhuanlan.zhihu.com/p/561144957


發表留言