> 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/script-editor-and-debugging.md).

# Script Editor & Debugging

### Script Editor

Python scripts can be edited directly inside Grid Studio using the integrated Script Editor.

The editor provides syntax highlighting and Grid-specific autocomplete to help discover available scripting functions, Objects and Parameters while writing code.

For example:

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

Autocomplete is available directly inside the Grid Studio Script Editor.

### Using Autocomplete

The Grid Studio Script Editor provides autocomplete while writing Python code.

As you type, a list of matching functions, Objects, Parameters or other available scripting entries is shown automatically.

You can select an entry by clicking it with the mouse, or navigate through the list using the **Arrow Keys**.

Press **Tab** to insert the currently selected entry into the script.

If the autocomplete list is not currently visible, it can be opened manually using:

**Ctrl + Space**

This is useful after deleting or replacing part of an existing expression, or whenever the autocomplete list does not appear automatically.

<div align="left"><figure><img src="/files/VEri8V6VSSMFwR3OLUwf" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Use **Ctrl + Space** at any time inside the Script Editor to manually open the autocomplete list.
{% endhint %}

### Script Output

Standard Python `print()` statements can be used to output information while developing or testing a script.

For example:

```python
print("Script executed")
```

The output is shown in the **Grid Studio Log**.

Values can also be inspected directly:

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

print(position)
```

This is useful for checking incoming data, Parameter values or intermediate results while developing script logic.

### Script Errors

Python errors generated while executing a script are also reported in the Grid Studio Log.

For example, accessing a property on an invalid reference can result in an error during script execution.

The Log can therefore be used to inspect both explicit `print()` output and errors produced by the script.

### Editing Scripts in Visual Studio Code

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

To configure Visual Studio Code in Grid Studio, go to:

**File → Preferences → Script**

Under **Path to VS Code**, select the Visual Studio Code executable.

<div align="left"><figure><img src="/files/0wDyY3VDRkrHrxpAKY3V" alt="" width="448"><figcaption></figcaption></figure></div>

A typical installation path is:

```
C:/Users/[user_name]/AppData/Local/Programs/Microsoft VS Code/Code.exe
```

Once the path has been configured, scripts can be opened in Visual Studio Code directly from Grid Studio.

Grid Studio creates a temporary file linked to the corresponding script. Changes made and saved in Visual Studio Code are reflected back into the script in the Grid Studio project.

<div align="left"><figure><img src="/files/XpsjhIEikYympqMZEVVF" alt="" width="447"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Grid-specific autocomplete is only available in the integrated Grid Studio Script Editor. Visual Studio Code can still be used as an external editor for writing and editing scripts.
{% endhint %}

<div align="left"><figure><img src="/files/gM72W7ESUHHTk9bm94M1" alt="" width="563"><figcaption></figcaption></figure></div>

### Choosing an Editor

For smaller scripts and when exploring the Grid Studio scripting API, the integrated Script Editor is usually the most convenient option because it provides Grid-specific autocomplete.

Visual Studio Code can be useful for larger scripts or when additional general-purpose editing tools are preferred.

Both editors work with the script stored in the Grid Studio project.

### Next Steps

See **Scripting API Reference** for the available Grid Studio scripting functions, utilities and APIs.
