# VS Code's built-in REPL does not seem to work with new contextual module repl under Julia 1.9

**URL:** <https://discourse.julialang.org/t/vs-codes-built-in-repl-does-not-seem-to-work-with-new-contextual-module-repl-under-julia-1-9/102256>\
**Category:** VS Code\
**Tags:** repl\
**Created:** [July 29, 2023, 9:17pm UTC](https://discourse.julialang.org/t/vs-codes-built-in-repl-does-not-seem-to-work-with-new-contextual-module-repl-under-julia-1-9/102256 "2023-07-29T21:17:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jinfreedom](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jinfreedom](https://discourse.julialang.org/u/jinfreedom)\
**Post date:** [July 29, 2023, 9:17pm UTC](https://discourse.julialang.org/t/vs-codes-built-in-repl-does-not-seem-to-work-with-new-contextual-module-repl-under-julia-1-9/102256/1 "2023-07-29T21:17:12Z")

</div>

VS Code’s built-in REPL, launched by` alt-J alt-O`, allows to execute code blocks from editor with shortcuts, thus quite useful in code development. Recent Julia 1.9 includes the very welcoming new feature of switching to a module environment, referred to as contextual module REPL in the following page.

> **[Julia 1.9 Highlights](https://julialang.org/blog/2023/04/julia-1.9-highlights/#contextual_module_repl)**
>
> Highlights of the Julia 1.9 release.

However, in VS code’s built-in REPL mentioned above, I can activate an imported module, but can’t seem to actually enter the environment:

```julia
(julia) pkg> 

julia> import Plots

julia> plot
ERROR: UndefVarError: `plot` not defined

(Plots) julia> plot
ERROR: UndefVarError: `plot` not defined

julia> using Plots

julia> plot
plot (generic function with 4 methods)

(Plots) julia> plot
plot (generic function with 4 methods)

(Plots) julia> a=rand()
0.07311357566664356

julia> a
0.07311357566664356

```

Here by entering the `Plots.jl` module environment, I can’t seem to access its members. I created the variable `a` and returned to the `Main` module, I still had access to that variable.

If I open a REPL from (integrated) bash, things seem to work correctly:

```julia
(@v1.9) pkg> activate .
  Activating project at `~/julia`

julia> import Plots

julia> plot
ERROR: UndefVarError: `plot` not defined

(Plots) julia> plot
plot (generic function with 4 methods)

(Plots) julia> a=rand()
0.33426183870409865

julia> 

julia> a
ERROR: UndefVarError: `a` not defined

julia> a=rand()
0.9991814038049677

(Plots) julia> a
0.33426183870409865

(Plots) julia> 

```

I would like to use the built-in REPL for its integration with the editor, but would like to be able to activate a module environment temporarily. What settings do I need to change in VS code to make this happen? Thanks a lot. I’m using VS code 1.80 under WSL ubuntu 20, with Julia extension 1.47.2.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [July 29, 2023, 10:44pm UTC](https://discourse.julialang.org/t/vs-codes-built-in-repl-does-not-seem-to-work-with-new-contextual-module-repl-under-julia-1-9/102256/2 "2023-07-29T22:44:05Z")

</div>

Will be fixed with [feat: support for REPL module switching by pfitzseb · Pull Request #3367 · julia-vscode/julia-vscode · GitHub](https://github.com/julia-vscode/julia-vscode/pull/3367).
