> For the complete documentation index, see [llms.txt](https://stage-precision.gitbook.io/grid/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stage-precision.gitbook.io/grid/scripting/scripting-overview.md).

# Scripting Overview

### Python in Grid Studio

Grid Studio uses **Python** for project-level scripting.

The scripting environment provides direct access to Grid Studio through the `sp` namespace. Every Object and Parameter in a project can be accessed and controlled from Python.

For example:

```python
sp.Camera1.coordinates.position.value = [0, 1, 2]
```

Standard Python functionality can be used alongside the Grid Studio scripting API. Additional external Python libraries can also be added to a project through **Global Imports**.

Scripting in Grid Studio is primarily intended for working with project data, Parameters and custom processing logic.

### Where Scripting Can Be Used

Scripting and script-based logic are available in several areas of Grid Studio:

* **Project Scripts** provide reusable scripts that can be executed manually or from Workflows.
* **Workflow Script Actions** add custom processing and logic directly to Workflows.
* **Script Modifiers** provide custom data processing with configurable inputs and outputs.
* **Object Filters** allow custom processing inside Maps and Filter pipelines.
* **Parameter Expressions** use Python-style expressions to calculate Parameter values from other project data.

Script-based expressions are also used in parts of the Widget system for dynamic values and conditions. These are documented separately in the Widget documentation.

Each scripting location is designed for a different type of task. The following sections of this documentation describe their individual behavior and available APIs in more detail.

### Accessing Grid Studio

Objects are accessed through their unique scripting ID using the `sp` namespace.

```python
sp.Camera1
```

Parameters can then be accessed through their path below the Object:

```python
sp.Camera1.camera.camera.focusDistance.value
```

These references can be used to read or change project data from scripts.

For reusable scripts, **Script Aliases** provide an additional way to reference Objects and Parameters without depending directly on their unique IDs.

```python
sp.alias.camera
```

{% hint style="warning" %}
Script Aliases are currently available as an **Experimental Feature**.
{% endhint %}

### Scripting Tools

Grid Studio includes an integrated Script Editor with Grid-specific autocomplete for working with the scripting API.

Scripts can also be edited externally using **Visual Studio Code**.

Python modules and external libraries used by a project can be configured through **Global Imports**, allowing common dependencies to be managed at project level.

Script output generated with functions such as `print()` is available in the Grid Studio Log.

### Scripting Documentation

The following pages cover the individual parts of the scripting environment in more detail:

* **Python Environment & Imports**
* **Accessing Objects and Parameters**
* **Expressions**
* **Script Aliases**
* **Project Scripts**
* **Workflow Script Actions**
* **Script Modifiers**
* **Object Filters**
* **Data Types & ValueTree**
* **Script Editor & Debugging**
* **Scripting API Reference**
