# Calling repl from Julia code?

**URL:** https://discourse.julialang.org/t/calling-repl-from-julia-code/7263
**Category:** General Usage
**Tags:** repl
**Created:** [November 23, 2017, 9:14am UTC](https://discourse.julialang.org/t/calling-repl-from-julia-code/7263 "2017-11-23T09:14:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Gyslain](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gyslain/32/4411_2.png) [@Gyslain](https://discourse.julialang.org/u/Gyslain)
#### Post date: [November 23, 2017, 9:14am UTC](https://discourse.julialang.org/t/calling-repl-from-julia-code/7263/1 "2017-11-23T09:14:24Z")

</div>

Hey, I would like to launch the REPL from a script in order to have an interactive session at a point of execution of my Julia program.  
`Base._start()` start the REPL, but after that, the program is stuck in the loop of the REPL without having the control on it.  
If I call the `Base._start()` from the REPL, I get a new working REPL. Instantiated variables from the first REPL are still reachable in the second one.  
can a script launch a new window terminal with a REPL inside?

---

<div class="post-metadata">

### Author: ![thautwarm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thautwarm/32/37760_2.png) [@thautwarm](https://discourse.julialang.org/u/thautwarm)
#### Post date: [August 20, 2019, 12:55pm UTC](https://discourse.julialang.org/t/calling-repl-from-julia-code/7263/2 "2019-08-20T12:55:24Z")

</div>

@Gyslain Have you found a solution?

**EDIT: also looking for such a thing**

---

<div class="post-metadata">

### Author: ![thautwarm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thautwarm/32/37760_2.png) [@thautwarm](https://discourse.julialang.org/u/thautwarm)
#### Post date: [August 20, 2019, 5:22pm UTC](https://discourse.julialang.org/t/calling-repl-from-julia-code/7263/3 "2019-08-20T17:22:45Z")

</div>

Use `Base.run_repl(Base.active_repl)` to call REPL anywhere, and enter CTRL+D to leave the (sub-) REPL.

---

<div class="post-metadata">

### Author: ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)
#### Post date: [January 28, 2023, 4:39pm UTC](https://discourse.julialang.org/t/calling-repl-from-julia-code/7263/4 "2023-01-28T16:39:09Z")

</div>

Is there a way to do it in recent versions?  
`Base.run_repl` does not exist.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [January 28, 2023, 4:46pm UTC](https://discourse.julialang.org/t/calling-repl-from-julia-code/7263/5 "2023-01-28T16:46:03Z")

</div>

```julia
julia> using REPL

help?> REPL
search: REPL replace replace!

  Run Evaluate Print Loop (REPL)

  Example minimal code
  
  import REPL
  term = REPL.Terminals.TTYTerminal("dumb", stdin, stdout, stderr)
  repl = REPL.LineEditREPL(term, true)
  REPL.run_repl(repl)
  

```
