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

**URL:** <https://discourse.julialang.org/t/using-functions-and-types-defined-in-a-module-inside-a-function/17600>\
**Category:** General Usage\
**Created:** [November 16, 2018, 4:14pm UTC](https://discourse.julialang.org/t/using-functions-and-types-defined-in-a-module-inside-a-function/17600 "2018-11-16T16:14:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ferran\_Mazzanti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ferran_mazzanti/32/7458_2.png) [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Post date:** [November 16, 2018, 4:14pm UTC](https://discourse.julialang.org/t/using-functions-and-types-defined-in-a-module-inside-a-function/17600/1 "2018-11-16T16:14:28Z")

</div>

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

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

```

Now in my Jupyter notebook I just have

```julia
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.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 17, 2018, 9:05am UTC](https://discourse.julialang.org/t/using-functions-and-types-defined-in-a-module-inside-a-function/17600/2 "2018-11-17T09:05:12Z")

</div>

> [@Ferran\_Mazzanti](#):
>
> using MyMod #loads correctly

Are you sure? There is an `end` missing.
