Using functions and types defined in a module, inside a function


#1

Dear all,
moving to Julia 0.7/1.0.2 brings in some problems with old code I have.
This time I have a user-defined module containing a fcuntion. This module is stored in a separate file MyMod.jl which I can acces as its location is in LOAD_PATH. The simple exemple is

module MyMod
   export f1
   function f1(x) = x*x
end

Now in my Jupyter notebook I just have

using MyMod #loads correctly

function f2(x)
   z = zero(10)
   for i in 1:10
      z[i] =  f1(rand())
   end
end

…but then it complains of now being able to use f1() stored in the module.
I’m 100% sure that this is a scope-related issue, since function f2() can not reach f1() from the module.

Can somebody tell me what do I have to do to make function f2 reach function f1 from the MyMod module?

Thanks in advance,

Ferran.


#2

Are you sure? There is an end missing.