# Include, using, export

**URL:** <https://discourse.julialang.org/t/include-using-export/35706>\
**Category:** New to Julia\
**Created:** [March 8, 2020, 4:25am UTC](https://discourse.julialang.org/t/include-using-export/35706 "2020-03-08T04:25:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [March 8, 2020, 4:25am UTC](https://discourse.julialang.org/t/include-using-export/35706/1 "2020-03-08T04:25:25Z")

</div>

Hi,

I wish to put experimental code in another file, call “TestFile”, and this file contains a function “TestFunction”. In my Main file called “main.jl”, I wish to access the function “TestFunction”. How do I do it? I tried

```julia
include("TestFile.jl")

```

and get the message “Could not open the file TestFile” or something similar.  
What is the easiest approach? Both the file “main.jl” and “TestFile.jl” are in the same directory, and I thought the current directory would automatically be in the LOAD\_PATH.

Thanks for any help! I have read the various discussions on the subject.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [March 8, 2020, 6:03am UTC](https://discourse.julialang.org/t/include-using-export/35706/2 "2020-03-08T06:03:13Z")

</div>

Please copy and paste the exact error message.  
It does sound like the file is not in the right directory. What does `pwd()` (“print working directory”, i.e. display the current directory) say?

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [March 8, 2020, 1:11pm UTC](https://discourse.julialang.org/t/include-using-export/35706/3 "2020-03-08T13:11:29Z")

</div>

I am in the correct directory according to pwd(). I will create an example for you to try.

Consider the file my\_test.jl with the code

```julia
module myModule
export myTest

function myTest()
    println("inside myTest")
end

myTest()

```

and my main code, from which I would like to access the “myTest” function:

```julia
include("my_module.jl")
using myModule

myModule.my_test
end

```

Both files are in the same directory, returned by pwd~().  
The include statement produces no errors.  
“using myModule” produces the error:

ArgumentError: Package myModule not found in current path:

- Run `import Pkg; Pkg.add("myModule")` to install the myModule package.  
require(::Module, ::Symbol) at loading.jl:887

I then run in REPL:

```julia
] add my_module

```

and get the error

ERROR: The following package names could not be resolved:

- my\_module (not found in project, manifest or registry)  
Please specify by known `name=uuid`.

Surely, there must be a way to include files with some mechanism without the need to update lower level machinery (project, manifest, registry)? Thanks.

What is the simplest way to accomplish the task? Thanks.

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [March 8, 2020, 1:36pm UTC](https://discourse.julialang.org/t/include-using-export/35706/4 "2020-03-08T13:36:52Z")

</div>

I think you just need `using .myModule`. The `.` is like a local path to indicate you want the local `myModule` at that path instead of a hypothetical package named `myModule`.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [March 8, 2020, 1:51pm UTC](https://discourse.julialang.org/t/include-using-export/35706/5 "2020-03-08T13:51:42Z")

</div>

Thank you! I figured it out just before I read the message. My working example code:

```julia
include("my_module.jl")
import .myModule: my_test
myTest()

```
