1# pip install pywin32 -> This will install the libs that are required
2import win32gui, win32con
3
4hide = win32gui.GetForegroundWindow()
5win32gui.ShowWindow(hide , win32con.SW_HIDE)
1Simply save it with a .pyw extension. This will prevent the console window from opening.