DSblizzard
DSblizzard

Reputation: 4149

How to start external program from Python script in the foreground?

import os
os.system("notepad macros.txt")

or

from subprocess import Popen
Popen(["notepad", "macros.txt"])

both start notepad in the background. How to start it in the foreground?

Upvotes: 5

Views: 5710

Answers (1)

Cédric Julien
Cédric Julien

Reputation: 80761

You can try to use the start command, maybe the /MAX option will force notepad to be in foreground, otherwise if you can wait untill notepad shutdown, use the /WAIT option/

Popen(["start", "/MAX", "notepad", "macros.txt"], shell=True)

Upvotes: 2

Related Questions