REPL in the middle of a script

hi. i am writing a script that, during processing, may occasionally want to drop into REPL (using some custom REPL), then, on a Ctrl-d, say, go back to processing. during any execution, the script may want to invoke its REPL zero, one, or more times.

i’m not sure how to accomplish this. iiuc, the -i option runs only after the script exits. also, i would rather have the script, when running, have isinteractive() return false (as i use its value for adapting the script’s interactions with the user), but the -i option has it return true.

is this possible? thanks!

You may use Infiltrator.jl:


@heliosdrm thanks! i’ll have to look and see how to meld that with ReplMaker.

@heliosdrm again, thanks. however, a trivial test generates a complaint from Infiltrator.jl:

bash apollo2 (main): {49701} cat x.jl
using Infiltrator

bash apollo2 (main): {49702} julia x.jl
Infiltrator.jl needs a proper Julia REPL.
bash apollo2 (main): {49703}

my vague sense is that if you are executing a script, the Julia runtime doesn’t set things up for a REPL. i guess then my question is, is there some way to cause things to be set so at REPL can run, either as the script is being initialized, or when the script gets to points where it decides to interact, via a REPL, with its user.

cheers, Greg

I think you should be able to do bash apollo2 (main): {49702} julia, and then


and Infiltrator should give you control.

hi, @PetrKryslUCSD – yes, that works (though with a slightly amended source file – below). my hope, though, is to have a “standard shell command”, command line arguments, etc. so, i’m hoping to find a way to do that.

using Infiltrator

function foo()


(Infiltrator doesn’t seem to work so well at the top level.)