# libtmux.Session.run_hook

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/38e368c11117fb4aeb2f082d552cd4f210eae06a/src/libtmux/hooks.py#L80
- **Inherited from:** libtmux.hooks.HooksMixin
- **Page:** https://libtmux.org/en/py/stable/reference/libtmux-session-run_hook/

tmux catalog: [Hooks](/en/tmux/latest/catalog/hooks/)

```
libtmux.Session.run_hook(
    self,
    hook: str,
    global_: bool | None = None,
    scope: OptionScope
    | _DefaultOptionScope
    | None = DEFAULT_OPTION_SCOPE,
) -> Self
```

Run a hook immediately. Useful for testing.

## Parameters

- `hook` (`str`)
- `global_` (`bool | None`)
- `scope` (`OptionScope | _DefaultOptionScope | None`)

## In other ports

### Run a session hook's commands now

- Go: [`tmux.Session.RunHook`](/en/go/latest/reference/tmux-session-runhook/) (method)
- Swift: [`Server.runHook(_:in:)`](/en/swift/latest/reference/server-runhook(_-in-)/) (method)
