SCRIPT / API / HOOK NAME
One-sentence description of what this customization point does and when to use it.
Python version: 3.11 (embedded)
Execution context: CONTEXT (e.g. project load, simulation step, post-process)
Overview
2–3 sentences. What problem does this hook/API solve? When is the script invoked?
Scripts run inside the application process. Unhandled exceptions will DESCRIBE IMPACT.
Prerequisites
- FASTSUITE E2 2026.1 or later
- Script file placed in
FOLDER_PATH/ - OPTIONAL: Additional module or license requirement
Script Signature
# Function / class signature with type hints
def on_event_name(context: EventContext) -> None:
"""
Called when DESCRIBE TRIGGER.
Args:
context: Provides access to DESCRIBE AVAILABLE DATA.
"""
...Available API
EventContext
| Attribute / Method | Type | Description |
|---|---|---|
context.project | Project | The current project object. Read-only. |
context.item | Item | The item that triggered the event. |
context.log(msg) | None | Write to the application log. |
context.cancel() | None | Abort the current operation. |
Project
| Attribute | Type | Description |
|---|---|---|
project.name | str | Project display name. |
project.path | Path | Absolute path to project file. |
Examples
Minimal Example
def on_event_name(context):
context.log(f"Triggered on: {context.item.name}")Full Example
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from fast.api import EventContext
def on_event_name(context: EventContext) -> None:
"""Validate item before processing."""
item = context.item
if not item.name.startswith("REQ_"):
context.log(f"WARNING: Item '{item.name}' does not follow naming convention.")
context.cancel()
return
context.log(f"Processing: {item.name}")Register via UI
- Open Settings > Customizing > Scripts.
- Click Add and browse to your
.pyfile. - Set the Event dropdown to
EVENT_NAME. - Click Save.
Execution Order
If multiple scripts are registered for the same event, they run in this order:
- Built-in validation (cannot be overridden)
- Project-level scripts (alphabetical)
- User-level scripts (alphabetical)
Logging and Debugging
context.log("Info message") # INFO level
context.log("Warning", level="warn") # WARN level — shown in UI
context.log("Error", level="error")# ERROR level — shown in UI + logged to fileLog output appears in View > Application Log and in %APPDATA%/FAST/logs/.
Limitations
- No access to the file system outside the project folder (sandboxed)
- Maximum execution time: 30 seconds — longer scripts will be killed
- Cannot import third-party packages — only the standard library and
fast.*
Related
Was this page helpful?