---
title: "Run Script"
description: "Another script file can be executed from within a running script using the syntax."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-script/statements/run-script
original: https://documentation.invantive.eu/en/docs/invantive-script/statements/run-script
updated: 2026-08-10T00:00:00Z
license: https://documentation.invantive.eu/en/
---

# Syntax
Another script file can be executed from within a running script using the syntax:
```
@@RELATIVE FILE NAME
@FILE NAME
```

The `@@` form resolves the file name relative to the folder of the script that contains
the statement. The `@` form takes the file name as given, so it also accepts an absolute
path. Both forms accept a [[Define|defined variable]], which allows a script to execute a
file it generated itself.

The statements of the executed file run within the calling script: variables defined
before the call remain in force, and a [[On Error|local on error]] mode set by the caller
continues to apply. The execution shows up as a separate run in the Invantive Script data
dictionary, with `parent_run_id` referring to the calling run and `nesting_level` one
higher.

# Examples
To execute a script file located next to the current one:
```
@@cs-build-contact-persons.psql
```

To execute a script file by absolute path held in a variable:
```
local define CORE_BUILD_FILE "c:\temp\build\core-build.sql"

@${CORE_BUILD_FILE}
```

This second form is what turns a query into executable statements. A script can write the
statements it wants to run with [[Export Results|local export results]] and then execute
that file, which is how a build script runs one [[Host|local host]] statement per product
without knowing the list of products beforehand.
