Use the "using" keyword instead of the "import" keyword, in conjunction with your (correct) intuition about "export".
module MyModule include("file.jl") export foo end ... using MyModule foo() MyModule.bar() On Monday, June 9, 2014 4:21:16 PM UTC-5, Davide Lasagna wrote: > > Hi all, > > I have a question about modules and I am probably missing something. > > Say that in file.jl I define functions foo and bar. I then create a file > MyModule.jl where I include file.jl as: > > module MyModule > > include("file.jl") > > end > > > At this point, in the REPL, doing import MyModule will give me access to > both foo and bar. Say, however, that I only want foo to be visible from > the outside, while I want bar to remain private, because it is some > accessory function used in foo. > > What is the preferred way to achieve this? I thought that after > include("file.jl") > I should have added an export foo to make it accessible to the outside, > but the include function is making everything in file.jl visible. > > Thanks, > > Davide > >