Filepaths in a module

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(""). 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:

module Foo
using CSV, DataFrames

loaded_data ="Foo"), "input", "data.csv"));

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?


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

Perfect! The @__DIR__ macro was exactly what I was looking for. Thanks.