highball2006

Run another python script via a batch file

Discussion created by highball2006 on Aug 31, 2012
Latest reply on Aug 31, 2012 by cblinnmrc
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.

Outcomes