Run another python script via a batch file

1573
1
08-31-2012 04:31 AM
JamesMorrison1
Occasional Contributor
Hello everyone.

A little bit more python than gis question. Sorry.

script:  main.py
script:  child.py
batch file: run.bat

main.py basically loads feature class data into SDE
so during gp.Append_management(my_source, my_target, "NO_TEST") I wish a sperate command window to open and run child.py which reports back a row count every 10 seconds

In main.py I want to pass two parameters to run.bat (fc_name, total_count)
The run.bat file will then pass on these parameters to child.py

The code in main.py should continue running and child.py should open in a sperate command window - hence why I though about via a .bat file.


I have tried os.spawn, subprocess.call, os.popen, os.startfile but sadly without success.

Can anyone help me with the syntax in main.py, run.bat and child.py to achieve this? Advice appreciated.
Tags (2)
0 Kudos
1 Reply
ChristopherBlinn1
Occasional Contributor III
This might be a helpful article.
0 Kudos