# Closing a Paraview gui using pvpython from an external process

**URL:** https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246
**Category:** ParaView Support
**Created:** [February 26, 2025, 6:55pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246 "2025-02-26T18:55:46Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Vivek\_Ojha](https://discourse.paraview.org/user_avatar/discourse.paraview.org/vivek_ojha/32/16061_2.png) [@Vivek\_Ojha](https://discourse.paraview.org/u/Vivek_Ojha)
#### Post date: [February 26, 2025, 6:55pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/1 "2025-02-26T18:55:46Z")

</div>

Hi,  
I have created a script using pvpython which outputs an interactive figure window with a field plotted on it. The script is run in the background using → /pvpython script.py &. After the figure has been plotted, is there a way to programmatically close this interactive GUI using another pvpython script. Secondly, if I find and kill the PID for the pvpython process, is that a clean way to achieving this workflow.  
Thanks!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 27, 2025, 8:52am UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/2 "2025-02-27T08:52:37Z")

</div>

> [@Vivek\_Ojha](#):
>
> this interactive GUI

Which interactive GUI ? The one you created in your python scripts ?

---

<div class="post-metadata">

### Author: ![Vivek\_Ojha](https://discourse.paraview.org/user_avatar/discourse.paraview.org/vivek_ojha/32/16061_2.png) [@Vivek\_Ojha](https://discourse.paraview.org/u/Vivek_Ojha)
#### Post date: [February 27, 2025, 2:40pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/3 "2025-02-27T14:40:46Z")

</div>

Yes, the window that pops up when you render a plot using pvpython

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 27, 2025, 2:45pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/4 "2025-02-27T14:45:22Z")

</div>

You can close this window by deleting the view and using the garbage collector.

---

<div class="post-metadata">

### Author: ![Vivek\_Ojha](https://discourse.paraview.org/user_avatar/discourse.paraview.org/vivek_ojha/32/16061_2.png) [@Vivek\_Ojha](https://discourse.paraview.org/u/Vivek_Ojha)
#### Post date: [February 27, 2025, 2:49pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/5 "2025-02-27T14:49:46Z")

</div>

Thanks for the quick reply. I have a few more questions about this approach. Could you tell me how to obtain the view, created by the first script, from a second script and where can I find info/doc on the garbage collector.

---

<div class="post-metadata">

### Author: ![Vivek\_Ojha](https://discourse.paraview.org/user_avatar/discourse.paraview.org/vivek_ojha/32/16061_2.png) [@Vivek\_Ojha](https://discourse.paraview.org/u/Vivek_Ojha)
#### Post date: [February 27, 2025, 2:56pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/6 "2025-02-27T14:56:04Z")

</div>

Also, does this approach require that I run both scripts after connecting to the a local pvserver?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 27, 2025, 3:01pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/7 "2025-02-27T15:01:31Z")

</div>

You do that with a single script, there is no need for multiple scripts here.

---

<div class="post-metadata">

### Author: ![Vivek\_Ojha](https://discourse.paraview.org/user_avatar/discourse.paraview.org/vivek_ojha/32/16061_2.png) [@Vivek\_Ojha](https://discourse.paraview.org/u/Vivek_Ojha)
#### Post date: [February 27, 2025, 3:05pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/8 "2025-02-27T15:05:52Z")

</div>

Sorry, I think I did not explain my workflow properly. Is is possible to generate a paraview figure using one script and closing the same figure using another script. I would like two separate scripts, one for generation of the figure and the other for programmatically closing the same figure. Let me know if this workflow is clear and is achievable

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 27, 2025, 3:17pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/9 "2025-02-27T15:17:53Z")

</div>

This is not achievable using standard pvpython scripting. You should use a single script.

---

<div class="post-metadata">

### Author: ![Vivek\_Ojha](https://discourse.paraview.org/user_avatar/discourse.paraview.org/vivek_ojha/32/16061_2.png) [@Vivek\_Ojha](https://discourse.paraview.org/u/Vivek_Ojha)
#### Post date: [February 27, 2025, 3:25pm UTC](https://discourse.paraview.org/t/closing-a-paraview-gui-using-pvpython-from-an-external-process/16246/10 "2025-02-27T15:25:23Z")

</div>

Thank you Mathieu
