> 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/accessing-objects-and-parameters.md).

# Accessing Objects and Parameters

### The `sp` Namespace

The `sp` namespace is available automatically inside Grid Studio scripts and provides access to the current project.

Each Object is accessed through its unique **Scripting ID**.

The Scripting ID combines the Object type with its numeric ID.

For example:

```python
sp.Camera1
sp.Tracker1
```

In these examples:

```
Camera + 1  → Camera1
Tracker + 1 → Tracker1
```

Different Object types use their own numbering, so `Camera1` and `Tracker1` can both exist in the same project.

When an Object is selected, its numeric ID is shown directly in the header of the Inspector.

<div align="left"><figure><img src="/files/qm81GA3PjnnWzriPQ1QA" alt="" width="352"><figcaption></figcaption></figure></div>

You can also click the **Info (i)** button in the Inspector header to open the Object information menu. The **Name/ID** entry shows the complete Scripting ID, such as `Camera1`, which can be used when referencing the Object from a script.

<div align="left"><figure><img src="/files/HOn4fFl3F3vxXAol71oY" alt="" width="352"><figcaption></figcaption></figure></div>

### Object Handles

Referencing an Object returns an Object handle.

```python
camera = sp.Camera1
```

The handle can then be used to access Parameters and other functionality exposed by that Object.

For example:

```python
camera.coordinates.position
```

Object handles can also be stored in variables and reused throughout a script.

```python
camera = sp.Camera1

print(camera.coordinates.position.value)
print(camera.camera.camera.focusDistance.value)
```

### Parameter Handles

Accessing a Parameter without `.value` returns the Parameter handle itself.

```python
position = sp.Camera1.coordinates.position
```

The current value of the Parameter is available through `.value`.

```python
position = sp.Camera1.coordinates.position.value
```

This distinction is useful because the Parameter handle provides access to the Parameter itself, while `.value` accesses its current value.

### Reading Parameter Values

Parameter values can be read directly from Python.

```python
position = sp.Camera1.coordinates.position.value

print(position)
```

Another example:

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

print(focus_distance)
```

The returned Python value depends on the Parameter type.

### Setting Parameter Values

Parameter values can be changed by assigning a new value to `.value`.

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

The same can be done through a stored Parameter handle:

```python
position = sp.Camera1.coordinates.position

position.value = [0, 1, 2]
```

This allows scripts to directly control Parameters in the project.

### Copying an Expression Address

Instead of manually writing a complete Object and Parameter path, Grid Studio can copy it for you.

Secondary-click a Parameter in the Inspector and select **Copy Expression Address**:

<div align="left"><figure><img src="/files/52ViviF0WZVFlCFlupKo" alt="" width="359"><figcaption></figcaption></figure></div>

The resulting address can then be pasted directly into a script or Parameter Expression.

For example:

```python
sp.Camera1.coordinates.position.value
```

This is especially useful for deeply nested Parameters.

The scripting address follows the same hierarchy used in the Inspector:

```
Object → Tab → Container → Parameter
```

Parameters can also be nested inside additional Containers:

```
Object → Tab → Container → Container → Parameter
```

Each additional Container simply adds another level to the scripting address.

For example:

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

corresponds to:

```
Camera1 → Camera → Camera → Focus Distance
```

Each level of the Inspector hierarchy becomes another part of the scripting address, separated by a dot. The final `.value` accesses the current value of the Parameter.

<div align="left"><figure><img src="/files/M9XiZtjMctvDrhuTTuST" alt="" width="350"><figcaption></figcaption></figure></div>

### Global and Relative Addresses

Grid Studio supports both **global** and **relative** addresses.

A global address starts from the `sp` namespace and references a specific Object in the project.

<div align="left"><figure><img src="/files/lLnC5OKo3hHqu8CKYljZ" alt="" width="158"><figcaption></figcaption></figure></div>

```python
sp.Camera1.coordinates.position.value
```

Relative references can be used in supported scripting and expression contexts when the target should be resolved relative to the current Object.

<div align="left"><figure><img src="/files/pWvnaAYkK9qT8CwLjHGI" alt="" width="158"><figcaption></figcaption></figure></div>

```python
coordinates.position.value
```

Relative addresses are useful when creating logic that should work across multiple Objects without being tied to one specific Object ID.

### Object IDs and Reusable Scripts

Unique scripting IDs such as:

```python
sp.Camera1
```

refer to a specific Object in the project.

When scripts should remain reusable across different Objects or projects, **Script Aliases** can be used instead of directly referencing a unique Object ID.

For example:

```python
sp.alias.camera.coordinates.position.value
```

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

See **Script Aliases** for more information about creating stable references to Objects and Parameters.

{% content-ref url="/pages/eU1jAResAPkB3BSOXm9Y" %}
[Script Aliases](/grid/scripting/script-aliases.md)
{% endcontent-ref %}
