# Reading input parameters from a text file

**URL:** <https://discourse.julialang.org/t/reading-input-parameters-from-a-text-file/131737>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 20, 2025, 3:12pm UTC](https://discourse.julialang.org/t/reading-input-parameters-from-a-text-file/131737 "2025-08-20T15:12:17Z")\
**Posts on this page:** 1\
**Showing post:** 15

<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:** [August 20, 2025, 11:20pm UTC](https://discourse.julialang.org/t/reading-input-parameters-from-a-text-file/131737/15 "2025-08-20T23:20:15Z")

</div>

> [@NonDairyNeutrino](#):
>
> In some sense, you want a collection of objects from a different context to be used in the simulation context. Well, that’s a module.

No, that’s a data structure.

For example, suppose you wanted to change the parameters in a loop. Or generate and save an ensemble of thousands of different parameter sets. A data structure can be updated dynamically or stored in an array, but a module is not designed for this.

I second @JoshuaLampert’s comment [above](https://discourse.julialang.org/t/reading-input-parameters-from-a-text-file/131737/4):

- Structure your code to provide functions and pass data via parameters (possibly packaging related parameters into data structures for convenience), not as scripts where the parameters are global variables.
- Create a Julia package+module to hold your simulation functions and data structure definitions (but not the parameter _values_ from individual runs). See [Best practise: organising code in Julia - #2 by stevengj](https://discourse.julialang.org/t/best-practise-organising-code-in-julia/74362/2)
- The prototypical way of saving parameters is probably a Julia script (that imports your module for the simulation functions, and then calls the functions with particular parameter values).
- Once you have parameters packed into Julia data structures, you can also save them into any compatible file format, e.g. JLD files or JSON.

---

_[View the full topic](https://discourse.julialang.org/t/reading-input-parameters-from-a-text-file/131737)._
