# How to determine if the repl is running?

**URL:** <https://discourse.julialang.org/t/how-to-determine-if-the-repl-is-running/111151>\
**Category:** General Usage\
**Tags:** question, repl\
**Created:** [March 4, 2024, 7:33pm UTC](https://discourse.julialang.org/t/how-to-determine-if-the-repl-is-running/111151 "2024-03-04T19:33:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Post date:** [March 4, 2024, 7:33pm UTC](https://discourse.julialang.org/t/how-to-determine-if-the-repl-is-running/111151/1 "2024-03-04T19:33:49Z")

</div>

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](https://stackoverflow.com/questions/59221798/julia-find-out-if-run-from-repl-or-command-line) 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:

```julia
#!/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.

---

<div class="post-metadata">

**Author:** ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Post date:** [March 5, 2024, 3:26am UTC](https://discourse.julialang.org/t/how-to-determine-if-the-repl-is-running/111151/2 "2024-03-05T03:26:09Z")

</div>

I ended up solving this with

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

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

```
