# "using" module within the same file where module was defined

**URL:** https://discourse.julialang.org/t/using-module-within-the-same-file-where-module-was-defined/6211
**Category:** General Usage
**Created:** [October 3, 2017, 4:31am UTC](https://discourse.julialang.org/t/using-module-within-the-same-file-where-module-was-defined/6211 "2017-10-03T04:31:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [October 3, 2017, 4:31am UTC](https://discourse.julialang.org/t/using-module-within-the-same-file-where-module-was-defined/6211/1 "2017-10-03T04:31:24Z")

</div>

I have the following scheme for writing tests: in a single file I define multiple modules, which are then “used”  
and the test function defined within them is run.

```julia
module mmiscellaneous1mmm
using FinEtools
using Test
function test()
  ... code omitted
  @test bfes.conn == [1 2; 5 1; 2 3; 3 4; 4 8; 9 5; 8 12; 10 9; 11 10; 12 11]
end
end
using mmiscellaneous1mmm
mmiscellaneous1mmm.test()

And so on, several modules in this file.

```

Today I downloaded the 0.7 and the tests would not run.

```julia
Miscellaneous: Error During Test
  Got an exception of type LoadError outside of a @test
  LoadError: ArgumentError: Module mmiscellaneous1mmm not found in current path.
  Run `Pkg.add("mmiscellaneous1mmm")` to install the mmiscellaneous1mmm package.
  Stacktrace:
   [1] _require(::Symbol) at .\loading.jl:417
  ... The rest is omitted

```

Is this a bug or feature?

My setup:

```julia
julia> versioninfo()
Julia Version 0.7.0-DEV.2036
Commit 6c4e30e367* (2017-10-02 16:24 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-6650U CPU @ 2.20GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake)
Environment:

```

---

<div class="post-metadata">

### Author: ![ararslan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ararslan/32/3825_2.png) [@ararslan](https://discourse.julialang.org/u/ararslan)
#### Post date: [October 3, 2017, 5:12am UTC](https://discourse.julialang.org/t/using-module-within-the-same-file-where-module-was-defined/6211/2 "2017-10-03T05:12:24Z")

</div>

It’s the expected behavior. Instead, use `using .mmiscellaneous1mmm` (note the leading `.`).

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [October 3, 2017, 2:22pm UTC](https://discourse.julialang.org/t/using-module-within-the-same-file-where-module-was-defined/6211/3 "2017-10-03T14:22:08Z")

</div>

@ararslan: Thanks!
