--- title: "system.perspective.closePopup" description: "Closes a popup view." --- # system.perspective.closePopup > Closes a popup view. This function is used in **Python Scripting**. ## Description ## Syntax :::tip This function accepts [keyword arguments](platform\scripting\python-scripting\user-defined-functions.md#keyword-arguments). ::: `system.perspective.closePopup(id, [sessionId], [pageId])` ### Parameters Type | Parameter | Description ------- | ------- | ------ String | `id` | The unique identifier for the popup, given to the popup when first opened. If given an empty string, then the most recently focused popup will be closed. String | `sessionId` | Identifier 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] String | `pageId` | Identifier of the page to target. If omitted, the current Page will be used automatically. [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 popup with the given id. system.perspective.closePopup('popup 4') ``` ```python title="Code Snippet" # Closes the last focused popup system.perspective.closePopup('') ```