Is it possible to change the behavior of a particular
using command? I know this sounds pretty terrible, and I’m only 10% serious about actually doing this. In particular, can one modify
import SomePackage to trigger some function even when the package is already loaded?
This is in the context of an issue with PyPlot + PackageCompiler I’m trying to fix. If PyPlot is in a sysimage, its init seems to run before any other Julia code runs, so it cannot hook up to IJulia cell triggers or find the appropriate backend. To do environment discovery correctly, one could rewrite PyPlot to set up the backend and IJulia hooks lazily when one runs the first plot command, but that seems like a lot of work. Could one override
import PyPlot to run a function that would hook PyPlot to IJulia if it’s not already hooked up?
I’m a bit embarassed about this, but I’m having a bit of trouble even finding
import in the Julia source. The docs point to the location of the keywords in the documentation, searching the repository for “import” is not very fruitful, and
@which seems to tell me that
import is not a function which takes a symbol. So maybe if someone could just point me to where they are, I can convince myself this can’t/shouldn’t be done.