Closing a Paraview gui using pvpython from an external process

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!

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

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

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

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.

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

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

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

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

Thank you Mathieu