---
title: "Global Scripts — Spiff Arena 0.1 documentation"
description: "Global Scripts allow you to define custom Python functions that can be used across all your process models. They’re automatically loaded from a directory in your process model repository. If you need to make network…"
source_url: https://spiff.works/docs/spiff-arena/how_to_guides/extend_the_system/global_scripts.html
---

☰ Menu

# Global Scripts[](#global-scripts "Link to this heading")

Global Scripts allow you to define custom Python functions that can be used across all your process models.
They’re automatically loaded from a directory in your process model repository.
If you need to make network calls, use connectors instead.

## Configuration[](#configuration "Link to this heading")

Global Scripts are **disabled by default**. To enable:

```
SPIFFWORKFLOW_BACKEND_GLOBAL_SCRIPTS_DIR=global-scripts
```

Scripts go in `process-models/global-scripts/` (or whatever directory you specify).

## Creating Scripts[](#creating-scripts "Link to this heading")

Create a Python class that extends `Script`:

```
from typing import Any
from spiffworkflow_backend.models.script_attributes_context import ScriptAttributesContext
from spiffworkflow_backend.scripts.script import Script

class HelloWorld(Script):
    def get_description(self) -> str:
        return "Returns a greeting"

    def run(self, script_attributes_context: ScriptAttributesContext, *args: Any, **kwargs: Any) -> Any:
        return "Hello World"
```

Class names are converted to snake\_case: `HelloWorld` → `hello_world()`

Save this in `hello_world.py` (file names should match the function name).

## Usage[](#usage "Link to this heading")

Use your scripts in process models:

```
# In script tasks
result = hello_world()

# In expressions
if hello_world() == "Hello World":
    # do something
```
