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

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

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

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

Hi,

Sorry for not including the error message

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

Sorry to state the obvious but that would suggest that my_function is not defined inside the module.

module MyModule

function my_function()
end

end

perhaps you did this


module MyModule

end

function my_function()
end

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

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?)