# setup # ... # now show the panel self.view.window().run_command("show_panel", {"panel": "console" }) # now run the command # ... # now return focus to the editor self.view.window().focus_group(0)

However, if I've got multiple Tab groups (by switching with alt+shift+2, for example) and I'm in the second pane, this always returns focus to group 0 (because that's what I've asked the function to do...)

Is there a way to make it return focus to the same one that gets focussed if I close the console (with Esc)?