# How to call functions defined in separate files in julia-1.6?

**URL:** https://discourse.julialang.org/t/how-to-call-functions-defined-in-separate-files-in-julia-1-6/77098
**Category:** General Usage
**Created:** [February 25, 2022, 9:01pm UTC](https://discourse.julialang.org/t/how-to-call-functions-defined-in-separate-files-in-julia-1-6/77098 "2022-02-25T21:01:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jjdegruijter](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jjdegruijter](https://discourse.julialang.org/u/jjdegruijter)
#### Post date: [February 25, 2022, 9:01pm UTC](https://discourse.julialang.org/t/how-to-call-functions-defined-in-separate-files-in-julia-1-6/77098/1 "2022-02-25T21:01:30Z")

</div>

In julia-1.0 I called a function"readdata()" that I defined in a file called “readdata”, from a start-up code in another file “main”.  
In julia-1.6 that does not seem to work anymore. I get “UndefVarError: readdata not defined”  
What is the problem and how can I solve it?

---

<div class="post-metadata">

### Author: ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)
#### Post date: [February 25, 2022, 9:40pm UTC](https://discourse.julialang.org/t/how-to-call-functions-defined-in-separate-files-in-julia-1-6/77098/2 "2022-02-25T21:40:47Z")

</div>

For the call `readdata()` to work, you must have first run either `readdata() = something` or

```julia
function readdata()
    something
end

```

. If you have that in a file, running `include("thatfilename.jl")` would do the trick.

---

<div class="post-metadata">

### Author: ![jjdegruijter](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jjdegruijter](https://discourse.julialang.org/u/jjdegruijter)
#### Post date: [February 26, 2022, 8:53am UTC](https://discourse.julialang.org/t/how-to-call-functions-defined-in-separate-files-in-julia-1-6/77098/3 "2022-02-26T08:53:12Z")

</div>

I have put “include(“readdata”)” in my start-up file “main”.  
When I try to run “main”, I get SystenError: “No such file or directory"

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [February 26, 2022, 9:28am UTC](https://discourse.julialang.org/t/how-to-call-functions-defined-in-separate-files-in-julia-1-6/77098/4 "2022-02-26T09:28:29Z")

</div>

Did you put `include("readdata")` exactly? Are you sure it shouldn’t be something like `include("/home/jaap/readdata.jl")`?

---

<div class="post-metadata">

### Author: ![jjdegruijter](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jjdegruijter](https://discourse.julialang.org/u/jjdegruijter)
#### Post date: [February 26, 2022, 9:47am UTC](https://discourse.julialang.org/t/how-to-call-functions-defined-in-separate-files-in-julia-1-6/77098/5 "2022-02-26T09:47:46Z")

</div>

At first I’ve put readdata.jl but that didn’t work. After I changed it to readdata (without.jl) my function readdata() was apparently actually called, but I got “Paused on exception” and a lot of text about CSV.

So I guess that’s the next problem.

Not sure what to do about that.
