# Structuring Julia Project

**URL:** <https://discourse.julialang.org/t/structuring-julia-project/40327>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [May 28, 2020, 8:41am UTC](https://discourse.julialang.org/t/structuring-julia-project/40327 "2020-05-28T08:41:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![akhil\_teja](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akhil_teja/32/15235_2.png) [@akhil\_teja](https://discourse.julialang.org/u/akhil_teja)\
**Post date:** [May 28, 2020, 8:41am UTC](https://discourse.julialang.org/t/structuring-julia-project/40327/1 "2020-05-28T08:41:43Z")

</div>

Hi Community,

I’m trying to structure my Julia Project but failing to import modules from one dir to another dir. Below is my Project Structure

```julia
|--Algorithms
    |-- src
       |--Algebra
             |-- algebra.jl
             |-- Testalgebra.jl
       |-- maths
             |-- maths.jl
             |-- Absolute.jl
    |-- Algorithms.jl

```

I’m trying to import Module Maths defined in maths.jl to TestAlgebra.jl, But I’m having no clue. Getting below Error Message.

WARNING: could not import Algebra.Maths into Algebra

Note: I don’t want add include in TestAlgebra.jl as I’ve already added in Algorithms.jl

The contents can be found in this link.

> **[Algorithms-Julia/src at master · Enforcer007/Algorithms-Julia](https://github.com/Enforcer007/Algorithms-Julia/tree/master/src)**
>
> master/src

Thanks  
Akhil

---

<div class="post-metadata">

**Author:** ![virtualgraham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/virtualgraham/32/15200_2.png) [@virtualgraham](https://discourse.julialang.org/u/virtualgraham)\
**Post date:** [May 28, 2020, 9:14am UTC](https://discourse.julialang.org/t/structuring-julia-project/40327/2 "2020-05-28T09:14:16Z")

</div>

Here is the code peiced together with the `include`s removed

```julia
module Maths
	function abs_value(x)
    	return x>0 ? x : -x
	end
end

module Algebra
	import ..Maths
	function add_value(x)
    	return Maths.abs_value(x)+5
	end
end

print(Maths.abs_value(-98))

```

Notice that ive changed `.Maths` to `..Maths` because its in a parent module

---

<div class="post-metadata">

**Author:** ![ettersi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ettersi/32/6829_2.png) [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Post date:** [May 28, 2020, 9:14am UTC](https://discourse.julialang.org/t/structuring-julia-project/40327/3 "2020-05-28T09:14:39Z")

</div>

See also the documentation [here](https://docs.julialang.org/en/v1/manual/modules/#Relative-and-absolute-module-paths-1).

---

<div class="post-metadata">

**Author:** ![akhil\_teja](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akhil_teja/32/15235_2.png) [@akhil\_teja](https://discourse.julialang.org/u/akhil_teja)\
**Post date:** [May 28, 2020, 9:47am UTC](https://discourse.julialang.org/t/structuring-julia-project/40327/4 "2020-05-28T09:47:55Z")

</div>

Thanks Graham, for the solution.

---

<div class="post-metadata">

**Author:** ![akhil\_teja](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akhil_teja/32/15235_2.png) [@akhil\_teja](https://discourse.julialang.org/u/akhil_teja)\
**Post date:** [May 28, 2020, 9:55am UTC](https://discourse.julialang.org/t/structuring-julia-project/40327/5 "2020-05-28T09:55:07Z")

</div>

Is there a better way or standard Julian way to write Imports.

In Algorithms.jl File, the code doesn’t speaks from where module - Algebra got imported:

```julia
include("maths/maths.jl") # Maths Directory
include("Algebra/algebra.jl")
print(Algebra.add_value(-98))

```

Code maintainence will be an issue if codebase becomes larger. How can I address this ?

---

<div class="post-metadata">

**Author:** ![virtualgraham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/virtualgraham/32/15200_2.png) [@virtualgraham](https://discourse.julialang.org/u/virtualgraham)\
**Post date:** [May 28, 2020, 10:41am UTC](https://discourse.julialang.org/t/structuring-julia-project/40327/6 "2020-05-28T10:41:45Z")

</div>

For most projects I try not to use sub modules. I divide projects into separate files or even folders, but generally they are usually just all included in one single module. But that’s just me.
