0

I am a Python novice, I cannot find an answer.

My test code is:

import subprocess
import time
#
subprocess.Popen(["C:\SAOImageDS9\ds9.exe", "./test1.fits"])
time.sleep(5.0)
subprocess.Popen(["C:\SAOImageDS9\ds9.exe", "./test2.fits"])

If the case of Notepad, I want to open test.txt and test2.txt in one Notepad window.

I run this code, but 2 windows were opened. I want to see files in one process.

Thank you.

evadeflow
  • 4,704
  • 38
  • 51
  • 2 executions = 2 processes. But you can prevent from opening a window for each one with `startup` option: https://stackoverflow.com/questions/7006238/how-do-i-hide-the-console-when-i-use-os-system-or-subprocess-call – Jean-François Fabre Apr 27 '21 at 06:12
  • It's not entirely clear what you're trying to achieve, but I don't think Notepad will allow you to open multiple files at the same time. If using [Notepad++](https://notepad-plus-plus.org/) is acceptable, you could invoke it the first time with `-nosession`, and then omit `-nosession` on subsequent invocations. In other words, run `"c:\Program Files (x86)\Notepad++\notepad++.exe" -nosession test1.txt`, sleep 5 seconds, and then run `"c:\Program Files (x86)\Notepad++\notepad++.exe" test2.txt`. This will open both files in the same window, using different tabs. – evadeflow Apr 27 '21 at 20:18

0 Answers0