Changing DISPLAY environment variable

Hello!
I have a long running python process inside a tmux pane. plt.show() will pop up a window with my plots if I run this process locally or if I start python from ssh, but if I call plt.show() from ssh using a process that was started locally the plot is not tunneled through ssh. I’ve tried changing the DISPLAY env variable by os.environ[‘DISPLAY’]=‘localhost:10.0’ (or whatever the right value is) but the plots don’t get through ssh. I’ve also tried to importlib.reload matplotlib and plt, but still doesn’t work.

Is there a way to forward the plot window through ssh when the process has already used matplotlib through a local display?

Thanks!

You can change the display in an existing process. Maybe instead you’d want to run it in x11vnc and connect to that as needed.