# Exporting from a nested module

**URL:** <https://discourse.julialang.org/t/exporting-from-a-nested-module/87330>\
**Category:** New to Julia\
**Tags:** module, modules\
**Created:** [September 15, 2022, 6:51pm UTC](https://discourse.julialang.org/t/exporting-from-a-nested-module/87330 "2022-09-15T18:51:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeroen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeroen/32/39091_2.png) [@Jeroen](https://discourse.julialang.org/u/Jeroen)\
**Post date:** [September 15, 2022, 6:51pm UTC](https://discourse.julialang.org/t/exporting-from-a-nested-module/87330/1 "2022-09-15T18:51:18Z")

</div>

Hello, I have a module called `MathSolver` with another module called `Parser` inside it. I define a macro `@math` inside the `Parser` module, which I want to be available when someone uses `using MathSolver`. However, I can’t figure out how to achive this, and I get the following error:

```julia-auto
Tests: Error During Test at .../runtests.jl:3
  Got exception outside of a @test
  LoadError: UndefVarError: @math not defined

```

### `MathSolver.jl`

```julia
module MathSolver

include("Parser.jl")

export @math

end

```

### `Parser.jl`

```julia
module Parser

export @math

macro math(expression)
    # ...
end

end

```

### `parsertest.jl`

```julia
using MathSolver

# It can parse a simple expression
plus = new_node("+")
append_child!(plus, "x")
append_child!(plus, 4)

result = @math x + 4
@test result == plus

```

I hope someone can help me. Thank you!

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [September 15, 2022, 6:52pm UTC](https://discourse.julialang.org/t/exporting-from-a-nested-module/87330/2 "2022-09-15T18:52:36Z")

</div>

> [@Jeroen](#):
>
> ```julia
> module MathSolver
> 
> include("Parser.jl")
> 
> export Parser.@math
> 
> end
> 
> ```

or add

```julia
using .Parser

```

after the ` include` .

(including the module doesn’t has the same effect of `using` , it does not bring the module exported things into scope)
