Create and use local module

Maybe I am missing the point but this works for me:

main.jl:

module myMain
# How to lod myPlot module here?

include("myPlot.jl")
using .myPlot

end # module

myPlot.jl:

module myPlot

using Plots

function plotSine()
    x = LinRange(0,1,11)
    y = sin.(x)
    gr()
    p = plot(x,y, title="hi test 2")
    plot!(p,x,y.*2)
    display(p)
end

end

Both files in d:\Temp, in the REPL:

julia> cd("d:\\temp")

julia> include("main.jl")

julia> myMain.myPlot.plotSine()

I once had a similar issue and got my help in this thread, maybe you find some insights too:

1 Like