# How to include a module from a specific path directory in REPL of VS Code?

**URL:** <https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 5, 2021, 11:10pm UTC](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914 "2021-08-05T23:10:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [August 5, 2021, 11:10pm UTC](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914/1 "2021-08-05T23:10:07Z")

</div>

I have a module called (SynchronousMachines) in this path directory (C:\Work\Julia\Simulation\SynchronousMachine), as seen below:

 ![1](https://global.discourse-cdn.com/julialang/original/3X/a/4/a41342d1761f2d58b15114b0f3280584ce2a0331.png)

I need to include this module from the RELP (not main code) in VS code. For this I am writing the below code but I am having an error:

```julia
julia> include(".\\..\\SynchronousMachine\\SynchronousMachines.jl")
ERROR: SystemError: opening file "C:\\Users\\SynchronousMachine\\SynchronousMachines.jl": No such file or directory
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base .\error.jl:168
  [2] #systemerror#62
    @ .\error.jl:167 [inlined]
  [3] systemerror
    @ .\error.jl:167 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing)
    @ Base .\iostream.jl:293
  [5] open
    @ .\iostream.jl:282 [inlined]
  [6] open(f::Base.var"#326#327"{String}, args::String; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base .\io.jl:328
  [7] open
    @ .\io.jl:328 [inlined]
  [8] read
    @ .\io.jl:434 [inlined]
  [9] _include(mapexpr::Function, mod::Module, _path::String)
    @ Base .\loading.jl:1144
 [10] include(fname::String)
    @ Base.MainInclude .\client.jl:444
 [11] top-level scope
    @ REPL[4]:1

julia> include("./../SynchronousMachine/SynchronousMachines.jl")
ERROR: SystemError: opening file "C:\\Users\\SynchronousMachine\\SynchronousMachines.jl": No such file or directory
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base .\error.jl:168
  [2] #systemerror#62
    @ .\error.jl:167 [inlined]
  [3] systemerror
    @ .\error.jl:167 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing)
    @ Base .\iostream.jl:293
  [5] open
    @ .\iostream.jl:282 [inlined]
  [6] open(f::Base.var"#326#327"{String}, args::String; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base .\io.jl:328
  [7] open
    @ .\io.jl:328 [inlined]
  [8] read
    @ .\io.jl:434 [inlined]
  [9] _include(mapexpr::Function, mod::Module, _path::String)
    @ Base .\loading.jl:1144
 [10] include(fname::String)
    @ Base.MainInclude .\client.jl:444
 [11] top-level scope
    @ REPL[6]:1

```

Any advice?  
Thanks

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [August 6, 2021, 10:59am UTC](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914/2 "2021-08-06T10:59:23Z")

</div>

Why do you use a relative path?  
Just use the full path:

```julia
include("C:\\Work\\Julia\\Simulation\\SynchronousMachine\\SynchronousMachines.jl")

```

If you want to use a relative path, you need to check

```julia
pwd()

```

to see where you are. Or you set your current path explicitly with:

```julia
cd("C:\\Work\\Julia\\Simulation\\SOME_PATH...")

```

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [August 6, 2021, 6:40pm UTC](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914/5 "2021-08-06T18:40:35Z")

</div>

> [@oheil](#):
>
> Why do you use a relative path?

I am using a relative path, because I am regularly sharing the folder of julia codes with my colleagues. So, avoiding the trouble of inserting different full paths on the REPLs of different computers.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [August 6, 2021, 7:16pm UTC](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914/6 "2021-08-06T19:16:03Z")

</div>

I see.  
I am not sure if you can expect that the current working directory after starting the REPL to be always the same for everybody.  
I have e.g. a starting path in my `startup.jl` which is not the one a plain REPL starts with on windows.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [August 6, 2021, 7:17pm UTC](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914/7 "2021-08-06T19:17:49Z")

</div>

Have a look at  
[https://github.com/GunnarFarneback/LocalRegistry.jl](https://github.com/GunnarFarneback/LocalRegistry.jl)  
this may be the solution for your use case.

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [August 6, 2021, 7:30pm UTC](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914/8 "2021-08-06T19:30:32Z")

</div>

Thank you very much!
