Hi,
I am currently trying to create a module and load it back again for further use yet having trouble in doing so. Consider the trivial example:
module MyModule
export x, y
x() = "x"
y() = "y"
p() = "p"
end
using MyModule
println(x())
This is in convention with the documentation:
https://docs.julialang.org/en/v1/manual/modules/#Summary-of-module-usage-1
Yet when I execute that code I get the following error:
ERROR: LoadError: ArgumentError: Package MyModule not found in current path:
- Run `Pkg.add("MyModule")` to install the MyModule package.
Stacktrace:
[1] require(::Module, ::Symbol) at .\loading.jl:817
[2] include_string(::Module, ::String, ::String) at .\loading.jl:1002
[3] (::getfield(Atom, Symbol("##118#123")){String,String,Module})() at C:\Users\adurmus\.julia\packages\Atom\WSz3k\src\eval.jl:120
[4] withpath(::getfield(Atom, Symbol("##118#123")){String,String,Module}, ::String) at C:\Users\adurmus\.julia\packages\CodeTools\hB4Hy\src\utils.jl:30
[5] withpath at C:\Users\adurmus\.julia\packages\Atom\WSz3k\src\eval.jl:46 [inlined]
[6] #117 at C:\Users\adurmus\.julia\packages\Atom\WSz3k\src\eval.jl:117 [inlined]
[7] hideprompt(::getfield(Atom, Symbol("##117#122")){String,String,Module}) at C:\Users\adurmus\.julia\packages\Atom\WSz3k\src\repl.jl:76
[8] macro expansion at C:\Users\adurmus\.julia\packages\Atom\WSz3k\src\eval.jl:116 [inlined]
[9] (::getfield(Atom, Symbol("##116#121")){Dict{String,Any}})() at .\task.jl:85
in expression starting at C:\Users\adurmus\Desktop\Julia Codes\asdsada.jl:10
However if I change using MyModule
to using Main.MyModule
I get the relevant output without no errors:
x
What seems to be the problem here? What am I missing in the documentation?
Thanks a lot in advance.