# Filepaths in a module

**URL:** <https://discourse.julialang.org/t/filepaths-in-a-module/12208>\
**Category:** Data\
**Created:** [July 6, 2018, 11:49am UTC](https://discourse.julialang.org/t/filepaths-in-a-module/12208 "2018-07-06T11:49:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Libbum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libbum/32/3935_2.png) [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Post date:** [July 6, 2018, 11:49am UTC](https://discourse.julialang.org/t/filepaths-in-a-module/12208/1 "2018-07-06T11:49:31Z")

</div>

I’m having difficulty finding the best way to manage external data files in a module I’m writing.

Say we have a module `Foo` that we add to our local packages through `Pkg.clone("https://repo.com/Foo.git")`. In the repository lies a folder `input` with a data file `data.csv` inside it.

What is the best method to load this csv file into a dataframe in my module?

Currently I self-reference the module’s local path using `Pkg.dir` like so:

```julia
module Foo
using CSV, DataFrames

loaded_data = CSV.read(joinpath(Pkg.dir("Foo"), "input", "data.csv"));
end

```

The call to `Pkg.dir("Foo")` seems a bit brittle here, but it functions for the moment. Is there a better way to do this though?

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [July 6, 2018, 11:59am UTC](https://discourse.julialang.org/t/filepaths-in-a-module/12208/2 "2018-07-06T11:59:02Z")

</div>

Try

```julia
joinpath(@ __DIR__ , "..", "input", "data.csv")

```

---

<div class="post-metadata">

**Author:** ![Libbum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libbum/32/3935_2.png) [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Post date:** [July 6, 2018, 12:02pm UTC](https://discourse.julialang.org/t/filepaths-in-a-module/12208/3 "2018-07-06T12:02:20Z")

</div>

Perfect! The [@\_\_DIR\_\_](https://docs.julialang.org/en/stable/stdlib/file/index.html#Base.@ __DIR__ ) macro was exactly what I was looking for. Thanks.
