# tmuxp.plugin.TmuxpPlugin.before_script

- **Module:** tmuxp.plugin.TmuxpPlugin
- **Package:** tmuxp
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/tmuxp/blob/153acdf6ff1268b14d3d03ed488f545a7123c8f1/src/tmuxp/plugin.py#L323
- **Page:** https://libtmux.org/en/py/latest/workspace/reference/tmuxp-plugin-tmuxpplugin-before_script/

```
tmuxp.plugin.TmuxpPlugin.before_script(self, session: Session) -> None
```

Provide a session hook after the workspace has been built.

This runs after the workspace has been loaded with ``tmuxp load``. It
augments instead of replaces the ``before_script`` section of the
workspace data.

This hook provides access to the LibTmux.session object for any
behavior that would be used in the ``before_script`` section of the
workspace file that needs access directly to the session object.
This runs after the workspace has been loaded with ``tmuxp load``.

The hook augments, rather than replaces, the ``before_script`` section
of the workspace. While it is possible to do all of the
``before_script`` workspace in this function, if a shell script
is currently being used for the workspace, it would be cleaner to
continue using the script in the ``before_section``.

If changes to the session need to be made prior to anything being
built, please use
:meth:`~tmuxp.plugin.TmuxpPlugin.before_workspace_builder` instead.

## Parameters

- `self`
- `session` (Session): session to hook into
