# What is the best way to use a config file that stores variables that my module needs

**URL:** <https://discourse.julialang.org/t/what-is-the-best-way-to-use-a-config-file-that-stores-variables-that-my-module-needs/127171>\
**Category:** General Usage\
**Created:** [March 20, 2025, 11:37am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-use-a-config-file-that-stores-variables-that-my-module-needs/127171 "2025-03-20T11:37:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghadgeabhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghadgeabhi/32/215920_2.png) [@ghadgeabhi](https://discourse.julialang.org/u/ghadgeabhi)\
**Post date:** [March 20, 2025, 11:37am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-use-a-config-file-that-stores-variables-that-my-module-needs/127171/1 "2025-03-20T11:37:33Z")

</div>

Having some issues and not finding the right way to add config files to my module. I have a lot of variables that change a lot when using my module and config files are the best way to do this.

I would like to know how best it is to employ a config file for this use case.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [March 20, 2025, 11:38am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-use-a-config-file-that-stores-variables-that-my-module-needs/127171/2 "2025-03-20T11:38:41Z")

</div>

Hard to say without more information, but you probably want Preferences.jl

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 20, 2025, 2:04pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-use-a-config-file-that-stores-variables-that-my-module-needs/127171/3 "2025-03-20T14:04:20Z")

</div>

> [@ghadgeabhi](#):
>
> I have a lot of variables that change a lot when using my module and config files are the best way to do this.

If they change when _using_ your module, i.e. they are _runtime_ parameters, then you probably don’t want to store them in the module itself. You should pass them as parameters to the module (and maybe also provide a function to load them from a config file as an _option_ if that is convenient … but _requiring_ users to edit a file every time they want to change a runtime parameter sacrifices a lot of flexibility).

Storing the parameters with your module itself (e.g. via Preferences.jl) is for things that are only set when you _install_ the module, and which are then left mostly unchanged.
