# Cant use module normally

**URL:** https://discourse.julialang.org/t/cant-use-module-normally/117973
**Category:** General Usage
**Tags:** module, using
**Created:** [August 8, 2024, 8:24pm UTC](https://discourse.julialang.org/t/cant-use-module-normally/117973 "2024-08-08T20:24:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![martin\_sanchez](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martin_sanchez/32/207525_2.png) [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)
#### Post date: [August 8, 2024, 8:24pm UTC](https://discourse.julialang.org/t/cant-use-module-normally/117973/1 "2024-08-08T20:24:36Z")

</div>

In [This tutorial](https://www.educative.io/answers/how-to-import-a-custom-module-in-julia) they even have an online code executer in which they set the example of using a module. They first have a file mymodule.jl in which they write:

`module MyModule

export sum\_function, resta

function sum\_function(a, b)  
return a + b  
end  
function resta(a,b)  
a-b  
end  
end # end of module definition`

And a main.jl file in which they write:

```julia
include("mymodule.jl")
using MyModule

result = resta(2, 3)

print(result)

```

When I try to mimic this same structure in my files, I have a file called cont\_stoch\_proc.jl in which I have a toy example:

```julia
module ContStochProc
export f

function f(x, y,z...) 
    value=x*y
    for i in z
        value+=i
    end 
    return value
end
end # module ContStochProc

```

And a file called prueba.jl in which I have:

```julia
include("cont_stoch_proc.jl")
using ContStochProc
f(2,3,1,1,1,1,1)

```

But when I run it, it shows me an error, signaling I do not have that module in my path

```julia
ERROR: ArgumentError: Package ContStochProc not found in current path, maybe you meant `import/using .ContStochProc`.

```

First question would be why does it work on the web but not in my project? I also realized that it works only if I write

```julia
using Main.ContStochProc

```

So why only in my project I need to use the “Main.” module path to run it? (this also happens if I try to use import ContStochProc.f as is used in the example

---

<div class="post-metadata">

### Author: ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)
#### Post date: [August 8, 2024, 8:37pm UTC](https://discourse.julialang.org/t/cant-use-module-normally/117973/2 "2024-08-08T20:37:53Z")

</div>

The tutorial is wrong, I’m not sure if it’s just using an older version of Julia. To use a locally defined module you would generally use `using .ContStochProc`. Per the [manual](https://docs.julialang.org/en/v1/manual/modules/#Standalone-using-and-import): “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: ![\_bernhard](https://avatars.discourse-cdn.com/v4/letter/_/bc79bd/32.png) [@\_bernhard](https://discourse.julialang.org/u/_bernhard)
#### Post date: [August 8, 2024, 8:40pm UTC](https://discourse.julialang.org/t/cant-use-module-normally/117973/3 "2024-08-08T20:40:02Z")

</div>

I just want to add, that the error hint already tells you the right answer. 😃

> [@martin\_sanchez](#):
>
> ```julia
> ERROR: ArgumentError: Package ContStochProc not found in current path, maybe you meant `import/using .ContStochProc`.
> 
> ```

---

<div class="post-metadata">

### Author: ![martin\_sanchez](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martin_sanchez/32/207525_2.png) [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)
#### Post date: [August 8, 2024, 9:44pm UTC](https://discourse.julialang.org/t/cant-use-module-normally/117973/4 "2024-08-08T21:44:54Z")

</div>

Thank you. I also found that after making the question but knowing the tutorial is not the way it should work really helps.

---

<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: [August 9, 2024, 12:55am UTC](https://discourse.julialang.org/t/cant-use-module-normally/117973/5 "2024-08-09T00:55:43Z")

</div>

> [@Satvik](#):
>
> The tutorial is wrong

The author’s other writings seem to be generated text due to a particular redundant format and self-contradicting mistakes so close that a human wouldn’t make them, e.g. `13 print(x is y) # Output: True` followed by the “Explanation” list saying “Line 13: We again check if `x` and `y` refer to the same object in memory. Since both variables now contain the value `300`, which is out of the range `-5` to `256`, the output will be `False`.” The languages and topics are also all over the place, really casting doubt on any human making a tutorial with any purpose.

There’s lots of junk on the internet now, it’s tough for people trying to find tutorials organized to be more accessible than the Manual.
