Skip to Content

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 / MethodTypeDescription
context.projectProjectThe current project object. Read-only.
context.itemItemThe item that triggered the event.
context.log(msg)NoneWrite to the application log.
context.cancel()NoneAbort the current operation.

Project

AttributeTypeDescription
project.namestrProject display name.
project.pathPathAbsolute 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}")
  1. Open Settings > Customizing > Scripts.
  2. Click Add and browse to your .py file.
  3. Set the Event dropdown to EVENT_NAME.
  4. Click Save.

Execution Order

If multiple scripts are registered for the same event, they run in this order:

  1. Built-in validation (cannot be overridden)
  2. Project-level scripts (alphabetical)
  3. 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 file

Log 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.*

Was this page helpful?