Matplotlib interactive and TTYs vs. pipes: plot never appears

I’m building a major mode to interact with iPython from Emacs. When using a TTY for this interaction, with the qt5 backend, things work fine when producing a plot: the app start and the plot appears. When a pipe is used to communicate with iPython (stdin/out + stderr), matplotlib launches the qt5 app, the lovely color-radar-beams icon bounces endlessly on the dock, and no plot ever appears. Eventually it stops bouncing (after 2min or so), but no plot. doesn’t help, nor plt.ion().

The main difference between pipe and TTY communication is the latter processes various control characters, such as Ctrl-D. Does matplotlib somehow make use of control characters for controlling or launching interactive plots?

Any ideas, or thoughts on how to get more information on what the qt5 display app is doing here? Thanks!

Update: If I use plt.pause(10), the plot appears and I can interact normally (for 10 secs anyway). So it seems the pipe is somehow preventing iPython from “sharing” its event loop with matplotlib.