> For the complete documentation index, see [llms.txt](https://docs.violetlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.violetlabs.com/features/scripts.md).

# Scripts

Violet **Scripts** allow you to author and run code that can reference (and write to) your live Violet data.

<figure><img src="/files/G8LKAq6CGzZNEWY0qb7X" alt=""><figcaption></figcaption></figure>

## Overview

Use Scripts to size subsystems, analyze test results, compare data between applications, generate reports or execute external simulations and workflows.

Script outputs can be consumed or referenced elsewhere in Violet, for example in [Parameters](/features/parameters.md), [Requirements](/features/requirements.md) and [Verifications](/features/requirements/verifications.md).

Violet Scripts function as embedded Jupyter Notebooks and can contain 1 or more *code cells*. For a primer on Jupyter, we recommend you check out their how-to [here](https://jupyter-notebook.readthedocs.io/en/stable/notebook.html).

## Getting started

To get started, navigate to **Scripts** and click <img src="/files/Wq0HhqtCggPjqe4U0sFT" alt="" data-size="line">.

In the Inspector panel, select Settings. Provide a name and description (optional) for your script, and specify your language of choice: Python, Julia or MATLAB.

Next, let's test your skills. With Python selected, type `print('hello world')` in a code cell and click **Run All**. This will execute the script and display the output below the cell.

<figure><img src="/files/xLqd2ePlzrbKYXT04sDP" alt="" width="563"><figcaption></figcaption></figure>

## Variables

Use Violet **Variables** to reference and consume your live Violet data. Variables will update automatically when the source data changes.&#x20;

Variables can reference data from [Integrations](/integrations/connect-your-data.md) (ie. live data from applications you've connected), [Parameters](/features/parameters.md), [Requirements](/features/requirements.md), [Verifications](/features/requirements/verifications.md) or other [Scripts](/features/scripts.md) outputs.

To create a Violet Variable, use the reserved syntax `Violet["variable_name"]` within your script, replacing `variable_name` with the name of your choice. Variable names must be unique within each script and can only contain letters, numbers and underscores.

In the **Inputs** panel, you will be prompted to link a property.

<figure><img src="/files/cqRX0S8atAipg2RVUKKk" alt="" width="563"><figcaption></figcaption></figure>

Use the search field to find and select the data of your choice, then click Run to see the updated results.

<figure><img src="/files/TzfRDTmFl3WCdF05gGqK" alt="" width="563"><figcaption></figcaption></figure>

## Auto-run

Setting a Script to **Auto-run** will trigger it to re-execute when the value of an input variable changes.

In the example below, a script variable is linked to a parameter. When the value of the parameter is updated, the script is automatically re-run, and the new results are shown:

{% embed url="<http://loom.com/share/64b842b256a64829b938181a906e137d>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.violetlabs.com/features/scripts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
