Search code examples
pythonsubprocesspyautogui

Script after opening jar file doesn't execute code after and not throwing any error


Script should open java file and fill inputs, so it opens file but it doesn't execute code that goes after and not showing any error in console. But if i open file manually and run code without opening file then everything is working

from pywinauto import application
import pyautogui
import subprocess

subprocess.call(['java', '-jar', 'C:\\Users\\User\\Desktop\\Folder\\file.jar'],shell=True)

time.sleep(3)
pyautogui.typewrite("login")
time.sleep(3)
pyautogui.moveTo(611,601)
pyautogui.click()
time.sleep(1)
pyautogui.click()
time.sleep(40)

Solution

  • subprocess.call waits for the subprocess to finish. You have to use subprocess.Popen instead.