> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testdriver.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# run

> Embed and execute another file within the current script.

## Description

The `run` command is used to embed and execute another file within the current script. This is **useful for reusing common sequences of commands or modularizing your scripts** for better organization and maintainability.

## Arguments

| Argument | Type     | Description                                                                                   |
| -------- | -------- | :-------------------------------------------------------------------------------------------- |
| `file`   | `string` | The path to the file to embed and run. Should be relative to the root of your git repository. |

## Example usage

```yaml theme={null}
command: run
file: relative/path/to/another-script.yaml
```

## Protips

* Use the `run` command to centralize reusable logic, such as login flows or setup steps, into separate files.
* Ensure the file path is relative to the current test file's directory. For example, if the test file is at `testdriver/homepage/chat-functionalities.yaml` and say the login snippet is present at the conventional `testdriver/snippets/login.yaml` it should be referrenced as :

```yaml highlight={2} theme={null}
command: run
file: ../snippets/login.yaml
```

## Gotchas

* If the specified file doesn't exist or contains errors, the command will fail.
* Ensure the embedded file is compatible with the current script's context, such as variable dependencies or session requirements.

## Notes

* The `run` command is ideal for creating modular and maintainable test scripts by reusing common workflows.
* This command supports nesting, allowing you to call scripts that themselves use the `run` command.
