# Cannot use access some functions in a module without activating the environemnt

**URL:** <https://discourse.julialang.org/t/cannot-use-access-some-functions-in-a-module-without-activating-the-environemnt/73471>\
**Category:** New to Julia\
**Tags:** package\
**Created:** [December 22, 2021, 7:09am UTC](https://discourse.julialang.org/t/cannot-use-access-some-functions-in-a-module-without-activating-the-environemnt/73471 "2021-12-22T07:09:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bossax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bossax/32/29872_2.png) [@Bossax](https://discourse.julialang.org/u/Bossax)\
**Post date:** [December 22, 2021, 7:09am UTC](https://discourse.julialang.org/t/cannot-use-access-some-functions-in-a-module-without-activating-the-environemnt/73471/1 "2021-12-22T07:09:15Z")

</div>

Hi all,

I am developing a module in Julia. I always activate the environment in the project folder when working on the module. However, when I want to use my module by `using MyModule` _some_ functions in the module are not accessible, producing `UndefVarError` when being called. I have to activate the environment first, then do `using MyModule` in order to make it work.

What do I miss?

Best

---

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [December 22, 2021, 8:20am UTC](https://discourse.julialang.org/t/cannot-use-access-some-functions-in-a-module-without-activating-the-environemnt/73471/2 "2021-12-22T08:20:57Z")

</div>

It is hard to tell without actual error messages  
does this fix it?

```julia
julia> push!(LOAD_PATH, "/path/to/MyModule")
julia> using MyModule

```

---

<div class="post-metadata">

**Author:** ![Bossax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bossax/32/29872_2.png) [@Bossax](https://discourse.julialang.org/u/Bossax)\
**Post date:** [December 22, 2021, 8:46am UTC](https://discourse.julialang.org/t/cannot-use-access-some-functions-in-a-module-without-activating-the-environemnt/73471/3 "2021-12-22T08:46:16Z")

</div>

> [@lawless-m](#):
>
> `push!(LOAD_PATH, "/path/to/MyModule")`

Hi,

Sorry for not including the error message

```julia
julia> using MyModule

julia> MyModule.my_function
ERROR: UndefVarError: my_functionnot defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base ./Base.jl:26
 [2] top-level scope
   @ none:1

```

Pushing the module path to the LOAD\_PATH does not work

---

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [December 22, 2021, 8:56am UTC](https://discourse.julialang.org/t/cannot-use-access-some-functions-in-a-module-without-activating-the-environemnt/73471/4 "2021-12-22T08:56:34Z")

</div>

Sorry to state the obvious but that would suggest that my\_function is not defined inside the module.

```julia
module MyModule

function my_function()
end

end

```

perhaps you did this

```julia

module MyModule

end

function my_function()
end

```

but we can only guess without seeing it (I don’t even know if that works !)

---

<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:** [December 22, 2021, 10:33am UTC](https://discourse.julialang.org/t/cannot-use-access-some-functions-in-a-module-without-activating-the-environemnt/73471/5 "2021-12-22T10:33:49Z")

</div>

You may have one version of the package installed in the main environment, which is not the same as the one you have in the project. (Is it a package?)
