# libtmux.Pane.respawn

- **Module:** libtmux.Pane
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/9fdd083a8181a827889337b63cd4e6daea661a8c/src/libtmux/pane.py#L2252
- **Page:** https://libtmux.org/en/py/latest/reference/libtmux-pane-respawn/

```
libtmux.Pane.respawn(self, shell: str | None = None, start_directory: StrPath | None = None, environment: dict[str, str] | None = None, kill: bool | None = None) -> None
```

Respawn the pane process via ``$ tmux respawn-pane``.

## Parameters

- `self`
- `shell` (str | None): Shell command to run in the respawned pane.
- `start_directory` (StrPath | None): Working directory for the respawned pane (``-c`` flag).
- `environment` (dict[str, str] | None): Environment variables (``-e`` flag).
- `kill` (bool | None): Kill the current process before respawning (``-k`` flag).
Required if the pane is still active.

## Example

```python
>>> pane = window.split(shell='sleep 1m')
>>> pane.respawn(kill=True, shell='sh')
```
