Skip to main content
Version: 8.1


This function is used in Python Scripting.


Send a message to a message handler within the same session.

The Scope Parameter

It is important to be mindful of the scope parameter when calling this function. It is possible to have multiple instances of a view open in a single page, thus invoking the function with a value of "page" for the scope parameter (or omitting the parameter) will invoke the message handlers on all valid message types. This advice is also applicable when the scope parameter value is passed as "session", as all instances of the matching message type in the whole session will be called.


system.perspective.sendMessage(messageType, payload, [scope], [sessionId], [pageId])


StringmessageTypeThe message type that will be invoked. Message handlers configured within the project are listening for messages of a specific messageType.
Dictionary[String, String]payloadA Python dictionary representing any parameters that will be passed to the message handler.
StringscopeThe scope that the message should be delivered to. Valid values are "session", "page", or "view". If omitted, "page" will be used. [optional]
StringsessionIdIdentifier of the Session to target. If omitted, the current Session will be used automatically. When targeting a different session, then the pageId parameter must be included in the call. [optional]
StringpageIdIdentifier of the page to target. If omitted, the current page will be used. [optional]




Gateway, Perspective Session


This function will only work in the Gateway scope if both sessionId and pageId are supplied to the call.

Code Examples

Code Snippet

# Sends a message to all Message Handlers configured on the current view, indicating that a new item has been added to a list.
system.perspective.sendMessage("NewItem", payload = {"itemName":"banana","itemQuantity":6}, scope = "view")


system perspective sendMessage, perspective.sendMessage