> 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/es/funciones/scripts.md).

# Scripts

Violet **Scripts** te permiten crear y ejecutar código que puede hacer referencia a (y escribir en) tus datos Violet en vivo.

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

## Descripción general

Usa Scripts para dimensionar subsistemas, analizar resultados de pruebas, comparar datos entre aplicaciones, generar informes o ejecutar simulaciones y flujos de trabajo externos.

Los resultados de los scripts pueden consumirse o referenciarse en otras partes de Violet, por ejemplo en [Parámetros](/es/funciones/parametros.md), [Requisitos](/es/funciones/requisitos.md) y [Verificaciones](/es/funciones/requisitos/verificaciones.md).

Los Scripts de Violet funcionan como notebooks de Jupyter integrados y pueden contener 1 o más *celdas de código*. Para una introducción a Jupyter, te recomendamos consultar su guía [aquí](https://jupyter-notebook.readthedocs.io/en/stable/notebook.html).

## Primeros pasos

Para empezar, navega a **Scripts** y haz clic en <img src="/files/76b61729845c7a62422410d05c62896acab6662f" alt="" data-size="line">.

En el panel Inspector, selecciona Configuración. Proporciona un nombre y una descripción (opcional) para tu script, y especifica tu lenguaje preferido: Python, Julia o MATLAB.

A continuación, pongamos a prueba tus habilidades. Con Python seleccionado, escribe `print('hello world')` en una celda de código y haz clic en **Ejecutar todo**. Esto ejecutará el script y mostrará la salida debajo de la celda.

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

## Variables

Usa Violet **Variables** para hacer referencia a tus datos Violet en vivo y consumirlos. Las variables se actualizarán automáticamente cuando cambien los datos de origen.&#x20;

Las variables pueden hacer referencia a datos de [Integraciones](/es/integraciones/conecta-tus-datos.md) (es decir, datos en vivo de las aplicaciones que has conectado), [Parámetros](/es/funciones/parametros.md), [Requisitos](/es/funciones/requisitos.md), [Verificaciones](/es/funciones/requisitos/verificaciones.md) u otras [Scripts](/es/funciones/scripts.md) salidas.

Para crear una variable Violet, usa la sintaxis reservada `Violet["variable_name"]` dentro de tu script, sustituyendo `variable_name` por el nombre que elijas. Los nombres de variables deben ser únicos dentro de cada script y solo pueden contener letras, números y guiones bajos.

En el **Entradas** panel, se te pedirá vincular una propiedad.

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

Usa el campo de búsqueda para encontrar y seleccionar los datos que prefieras, luego haz clic en Ejecutar para ver los resultados actualizados.

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

## Ejecución automática

Configurar un script para **Ejecución automática** hará que se vuelva a ejecutar cuando cambie el valor de una variable de entrada.

En el siguiente ejemplo, una variable del script está vinculada a un parámetro. Cuando se actualiza el valor del parámetro, el script se vuelve a ejecutar automáticamente y se muestran los nuevos resultados:

{% 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/es/funciones/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.
