Start external application from Python as new process
Asked Answered
B

1

3

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?

Bargello answered 25/9, 2020 at 6:10 Comment(0)
B
2

I had found solution:

os.startfile(r'"C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE"')
Bargello answered 25/9, 2020 at 6:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.