# libtmux.Window.last_pane

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/38e368c11117fb4aeb2f082d552cd4f210eae06a/src/libtmux/window.py#L775
- **Page:** https://libtmux.org/en/py/stable/reference/libtmux-window-last_pane/

tmux command: [`last-pane`](/en/tmux/latest/manual/last-pane/)

```
libtmux.Window.last_pane(
    self,
    disable_input: bool | None = None,
    enable_input: bool | None = None,
    keep_zoom: bool | None = None,
) -> Pane | None
```

Select the last (previously active) pane via [`$ tmux last-pane`](/en/tmux/latest/manual/last-pane/).

## Examples

```python
>>> pane1 = window.active_pane
>>> pane2 = window.split()
>>> pane2.select()
Pane(...)
>>> result = window.last_pane()
```

## Parameters

- `disable_input` (`bool | None`): Disable input to the pane (``-d`` flag). (added 0.56)
- `enable_input` (`bool | None`): Enable input to the pane (``-e`` flag). (added 0.56)
- `keep_zoom` (`bool | None`): Keep the window zoomed if zoomed (``-Z`` flag). (added 0.56)

## Returns

:class:`Pane` or None
    The selected pane, or None if no last pane exists.

## In other ports

### Return to the pane that was active before

- Rust: [`window.Window.last_pane`](/en/rs/latest/reference/window-window-last_pane/) (method)
- Go: [`tmux.Window.LastPane`](/en/go/latest/reference/tmux-window-lastpane/) (method)
- C#: [`LibTmux.Window.SelectLastPaneAsync`](/en/csharp/latest/reference/libtmux-window-selectlastpaneasync/) (method)
- C++: [`libtmux::Window::select_last_pane`](/en/cxx/latest/reference/libtmux-window-select_last_pane/) (method)
- Swift: [`Server.selectLastPane(in:)`](/en/swift/latest/reference/server-selectlastpane(in-)/) (method)
