Start external application from Python as new process

588 views Asked by At

How to start an external application with python but not using os.system or subprocess.call? This external application is one another Win32 console app. The problem with os.system('app') is that when executed external app is closed then I can continue with the rest of application, and with subprocess.call the output of that external app is inside python process.

import os
import subprocess

def runapp():
    os.system(r'"C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE"')
    anotherfunction()

def anotherfunction():
    # do something

In given example above when I close Word then anotherfunction() is called. Is there any other way to run external app?

1

There are 1 answers

0
Josef On

I had found solution:

os.startfile(r'"C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE"')