def restart_spotify(spotify_exe_path): """Terminates and restarts spotify""" spotify_hwnd = get_spotify_instance()._hwnd WindowsTools.kill_process_by_HWND(spotify_hwnd) WindowsTools.create_process(spotify_exe_path, creation_flags=WindowsTools.Defines.CREATE_NEW_CONSOLE)