def foregroundWindow(self): hwnd = AniImageBoard.getProcessHanddle(self.name) if hwnd == 0: raise RuntimeError('There is no Window.') User32.SwitchToThisWindow(hwnd, True)