# Using a module defined in REPL

**URL:** <https://discourse.julialang.org/t/using-a-module-defined-in-repl/110611>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [February 22, 2024, 11:01pm UTC](https://discourse.julialang.org/t/using-a-module-defined-in-repl/110611 "2024-02-22T23:01:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [February 22, 2024, 11:01pm UTC](https://discourse.julialang.org/t/using-a-module-defined-in-repl/110611/1 "2024-02-22T23:01:13Z")

</div>

```julia
julia> module A
       a = 1
       b = 2
       end
Main.A

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

julia> A.a
1

julia> A.b
2

julia> using A
ERROR: ArgumentError: Package A not found in current path, maybe you meant `import/using .A`.
- Otherwise, run `import Pkg; Pkg.add("A")` to install the A package.
Stacktrace:
 [1] macro expansion
   @ Base .\loading.jl:1766 [inlined]
 [2] macro expansion
   @ Base .\lock.jl:267 [inlined]
 [3] __require(into::Module, mod::Symbol)
   @ Base .\loading.jl:1747
 [4] #invoke_in_world#3
   @ Base .\essentials.jl:921 [inlined]
 [5] invoke_in_world
   @ Base .\essentials.jl:918 [inlined]
 [6] require(into::Module, mod::Symbol)
   @ Base .\loading.jl:1740

```

why is it wrong?

---

<div class="post-metadata">

**Author:** ![cmichelenstrofer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmichelenstrofer/32/44392_2.png) [@cmichelenstrofer](https://discourse.julialang.org/u/cmichelenstrofer)\
**Post date:** [February 22, 2024, 11:05pm UTC](https://discourse.julialang.org/t/using-a-module-defined-in-repl/110611/2 "2024-02-22T23:05:15Z")

</div>

you need to use a dot:

```julia
using .A

```

see [this section](https://docs.julialang.org/en/v1/manual/modules/) of the manual.

> To load a module from a package, the statement `using ModuleName` can be used. To load a module from a locally defined module, a dot needs to be added before the module name like `using .ModuleName` .

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [February 23, 2024, 1:14am UTC](https://discourse.julialang.org/t/using-a-module-defined-in-repl/110611/3 "2024-02-23T01:14:44Z")

</div>

and write `export a, b` if `using .A` is supposed to bring the names `a` and `b` into the current global scope. Alternative to unspecific `using` accessing the `export` list, you could also specify any names even the unexported ones: `using A: a, b`.
