If someone is interested.
I found that my question is essentially equivalent to “how do you make matplotlib’s nbagg backend work with IJulia”.
There is even an opened issue about it: JuliaPy/PyPlot.jl#137. It is dated back to 2015, and there was no progress since then.
It seems the problem can be solved if one replaces python’s CommSocket class with another one, created via PyCall’s @pydef and rerouting communication to IJulia kernel (see the last comment in the issue thread). I could try to do it.
Could someone, who knows PyCall, help me with two questions:
Can you @pydef a python class with references to Julia objects and Julia functions?
There is FigureManagerNbAgg class, which creates instances of CommSocket. In order for everything to work, I should overhaul the corresponding class method, where it happens, to instanciate my new @pydef-ed
class. How should I approach this? (I can think about replacing PyObject’s Dictionary field: PyClass[:somemethod] = new_julia_function. But will this actually work?)