--- title: "system.perspective.togglePopup" description: "Opens or closes a popup view." --- # system.perspective.togglePopup > Opens or closes a popup view. This function is used in **Python Scripting**. ## Description Toggles a [popup view](ignition-modules\perspective\views-in-perspective\popup-views.md). Will open up the popup if it has not been opened yet. Otherwise, it will close the currently opened popup. ## Syntax `system.perspective.togglePopup(id, view, [params], [title], [position], [showCloseIcon], [draggable], [resizable], [modal], [overlayDismiss], [sessionId], [pageId], [viewportBound])` ### Parameters Type | Parameter | Description ------- | ------- | ------ String |`id` | A unique popup string. Will be used to close the popup from other popup or script actions. String |`view` | The path to the view to use in the popup. Dictionary[String, Any] | `params` - Dictionary of key-value pairs to us as input parameters to the View. [optional] String |`title` | Text to display in the title bar. Defaults to an empty string. [optional] Dictionary[String, Integer] | `position` | Dictionary of key-value pairs to use for position. Possible position keys are: left, top, right, bottom, width, height. Defaults to the center of the window. [optional] Boolean| `showCloseIcon` | Will show the close icon if True. Defaults to True. [optional] Boolean| `draggable` | Will allow the popup to be dragged if True. Defaults to True. [optional] Boolean| `resizable` | Will allow the popup to be resized if True. Defaults to False. [optional] Boolean| `modal` | Will make the popup modal if True. A modal popup is the only view the user can interact with. Defaults to False. [optional] Boolean| `overlayDismiss` | Will allow the user to dismiss and close a modal popup by clicking outside of it if True. Defaults to False. [optional] 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] Boolean| `viewportBound` | If True, popups will be "shifted" to open within the bounds of the viewport. If the popup would be larger than the viewport, then it will be resized to fit within the bounds. Default is False. [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 - View" # Toggles a popup view. We are passing in two parameters, called "myParam" and "myParam2". system.perspective.togglePopup("myPopupId",'folder/myView', params = {"myParam":1,"myParam2":"Test"}) ```