opening a batch file but when it opens my python code is stopped because the batch file opens in the same window
Question: So I am basically trying to open and close a batch file (that runs a minecraft
server) at specific times. The thing that is bothering me though is that when
the file opens it does so in the same window as my script and therefore
basically stops my code which consiquently means that the file will have to be
manually closed. I was wondering if there is a way to open it in a separate
window. This is thd code I have so far:

    
    
    import os
    import time
    print "updates ever 15 mins = 0.25 hours"
    hours = input("Current time (nearest 0.25 hour): ")
    x = input("Opening time (hour): ")
    y = input("Closing time (hour): ")
    os.system ("cls")
    os.chdir ("C:\\Users\\USERNAME\\Desktop\\Server")
    while True:
        os.system("cls")
        time.sleep(900)
        hours += 0.25
        difx = x - hours
        dify = y - hours
        if difx == 0:
            os.popen("run.bat")
        if dify == 0:
            os.system ("say  CLOSING in 10 SECONDS")
            time.sleep (10)
            os.system ("stop")
            os.system ("taskkill /f /im cmd.exe")
        if hours == 25:
            hours = 1
    

stop is a command that stops the server running and saves all the info but
leaves the window open (hence the taskkill command). Any help would be much
appreciated.


Answer: Replacing os.popen("run.bat" with os.startfile("filepath\run.bat") should
work. (Thanks)

