How to determine if the repl is running?

I would like to know if the REPL has been started, the best answer that I could find is read eval print loop - Julia: find out if run from REPL or command line - Stack Overflow which suggests isinteractive(), but this only checks if the session is planned to be interactive, it gives the wrong result if I run the script:

#!/usr/bin/env -S julia -i

println(isinteractive())
sleep(5)

which prints true before the REPL is actually active. What I am looking for is something that can tell me whether the script has been executed from the bash prompt or whether it has been included from the REPL.

I ended up solving this with

#!/usr/bin/env -S julia -i

println(isdefined(Base, :active_repl)
sleep(5)