Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Create and use local module

$
0
0

Hi,

I want to make an application. So I do cd ; julia and then switch to Pkg mode and use generate to generate my application.

I then have a src/app.jl. Now I want to add a few files that do some fancy stuff. Apparently, I could use include to load those files but that’s bad because Revise doesn’t recognize it. The proper way is to make a module.

So I scope my files with the module keyword. Now I want to use them, but how?

Let’s say I have the following in my src/

main.jl

module test
# How to lod myPlot module here?
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

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795