# Organizing modules. Is it OK to organize a project using several modules in Julia?

**URL:** <https://discourse.julialang.org/t/organizing-modules-is-it-ok-to-organize-a-project-using-several-modules-in-julia/34535>\
**Category:** New to Julia\
**Created:** [February 12, 2020, 7:47pm UTC](https://discourse.julialang.org/t/organizing-modules-is-it-ok-to-organize-a-project-using-several-modules-in-julia/34535 "2020-02-12T19:47:29Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 12, 2020, 8:40pm UTC](https://discourse.julialang.org/t/organizing-modules-is-it-ok-to-organize-a-project-using-several-modules-in-julia/34535/5 "2020-02-12T20:40:03Z")

</div>

I would suggest that you start playing around with module structures without using `include` or `export`, just to get a sense of how they work. Here’s an example of a module which is itself composed of 3 submodules, and in which the `GameRunner` and `PlayerModule` modules can both correctly access the `Board` type from `BoardModule`:

```julia
julia> module GameAI
         module BoardModule
           struct Board end
         end
         
         module GameRunner
           using ..BoardModule: Board

           run(b::Board) = println("running: $b")
         end
         
         module PlayerModule
           using ..BoardModule: Board
           
           move(b::Board) = println("moving on: $b")
         end
       end
Main.GameAI

julia> using .GameAI

julia> board = GameAI.BoardModule.Board()
Main.GameAI.BoardModule.Board()                                                                                                                                  
                                                                                                                                                                 
julia> GameAI.GameRunner.run(board)
running: Main.GameAI.BoardModule.Board()                                                                                                                         
                                                                                                                                                                 
julia> GameAI.PlayerModule.move(board)
moving on: Main.GameAI.BoardModule.Board()   

```

You can move any of those modules into their own files and replace the module definition with `include("module.jl")` as you see fit, but it’s not necessary in order to understand the module organization.

The other rule of thumb is: a `.jl` file should not be included more than once in your code.

---

_[View the full topic](https://discourse.julialang.org/t/organizing-modules-is-it-ok-to-organize-a-project-using-several-modules-in-julia/34535)._
