# Global variables within 2 files

**URL:** <https://discourse.julialang.org/t/global-variables-within-2-files/40028>\
**Category:** New to Julia\
**Created:** [May 23, 2020, 3:54pm UTC](https://discourse.julialang.org/t/global-variables-within-2-files/40028 "2020-05-23T15:54:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [May 23, 2020, 6:17pm UTC](https://discourse.julialang.org/t/global-variables-within-2-files/40028/3 "2020-05-23T18:17:25Z")

</div>

Please quote your code when you ask a question: [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530)

It is a very bad idea to (i) use global variables, and (ii) especially a bad idea to share them between different files!

Instead, pass the variables as arguments to your functions. If you have many parameters, wrap them up into a type, e.g. using Parameters.jl.

---

_[View the full topic](https://discourse.julialang.org/t/global-variables-within-2-files/40028)._
