How to tell if a Pluto notebook is being run in Pluto or from REPL?

I have a Pluto notebook that uses the Pluto package manager.

I can run that notebook within Pluto.

I’d like to also be able to run it from the Julia REPL. When run from the REPL, I’d like some of the output to be written to files rather that to notebook output cells.

Also, to run the notebook in the REPL I need to conditionally call activate_notebook_environment to activate the right environment.

How can code in my notebook tell if it is being run in Pluto or in the Julia REPL.

Sorry, I think I asked this before, but can’t find the thread.



if @isdefined PlutoRunner  # running inside Pluto
1 Like


Thanks much.