22. Your run function and its caller
func run(call_context: Dictionary = {}) -> String:
var verb_id: String = str(call_context.get("verb", ""))
var source_id: String = str(call_context.get("entityId", ""))
Log("Verb: " + verb_id + "; source: " + source_id)
return source_idThe caller context explains why the script ran. An object response, a GUI button, a parser command and a manual Run Script call can provide different keys. Read an optional key with get and a fallback.
The inherited context member is refreshed for the call, and PCA’s helpers pass it on to nested actions/scripts. The parameter shown above is a local copy/reference to the supplied dictionary; naming it call_context avoids hiding the base member.
For initial inspection, Log(ToJSON(call_context)) shows ordinary data. Do not assume every context contains entityId, itemId, guiId, elementId or a parser command. Discover the relevant payload in a small test, then depend only on the keys that route supplies.
