# Precompilation & global variables

**URL:** <https://discourse.julialang.org/t/precompilation-global-variables/72515>\
**Category:** New to Julia\
**Created:** [December 3, 2021, 12:23pm UTC](https://discourse.julialang.org/t/precompilation-global-variables/72515 "2021-12-03T12:23:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![whatsthecraic](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@whatsthecraic](https://discourse.julialang.org/u/whatsthecraic)\
**Post date:** [December 3, 2021, 12:23pm UTC](https://discourse.julialang.org/t/precompilation-global-variables/72515/1 "2021-12-03T12:23:21Z")

</div>

If I understand it correctly, when precompiling package A, if a method in A is invoked and modifies a global variable in B, those changes are lost forever, but if the global variable is in A, then the changes are saved?

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [December 3, 2021, 12:32pm UTC](https://discourse.julialang.org/t/precompilation-global-variables/72515/2 "2021-12-03T12:32:43Z")

</div>

What exactly are you trying to do? As you noticed by your own question, relying on one package modifying global variables of the other package is something that will be unmaintainable. Independently of the actual answer to your question (which I don’t know if can be generalized), the advice is to _not_ rely on global variables in _any_ sense.
