--- title: "system.perspective.closePage" description: "Closes the page with the given page id or the current page if no page id is provided." --- # system.perspective.closePage > Closes the page with the given page id or the current page if no page id is provided. This function is used in **Python Scripting**. ## Description Closes the page with the given page id or the current page if no page id is provided. If a message is provided, it is displayed on the page when the page closes. Otherwise the default message (set in the [Project properties](ignition-modules\perspective\perspective-project-properties.md#perspective-general-properties)) is displayed. ## Syntax `system.perspective.closePage([message], [sessionId], [pageID])` ### Parameters Type | Parameter | Description ------- | ------- | ------ String | `message` | The message to display when the page closes. If omitted, the default message (set in the Project Properties) is shown. [optional] String | `sessionId` | Identifier of the Session to target. If omitted, the current Session will be used automatically. When targeting a different Session, the pageId parameter must be included in the call. [optional] String | `pageId` | Identifier of the page to be closed. If omitted, the current pageId is used. [optional] ### Returns Nothing ### Scope Gateway, Perspective Session :::note This function will only work in the Gateway scope if both `sessionId` and `pageId` are supplied to the call. ::: ## Code Examples ```python title="Code Snippet" # Closes the page with the given pageId. system.perspective.closePage('Your page has been closed.') ```