# Workflow question - how to guarantee no dependence on global state without long load times?

**URL:** <https://discourse.julialang.org/t/workflow-question-how-to-guarantee-no-dependence-on-global-state-without-long-load-times/24613>\
**Category:** New to Julia\
**Created:** [May 26, 2019, 5:23am UTC](https://discourse.julialang.org/t/workflow-question-how-to-guarantee-no-dependence-on-global-state-without-long-load-times/24613 "2019-05-26T05:23:29Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Nathaniel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathaniel/32/37854_2.png) [@Nathaniel](https://discourse.julialang.org/u/Nathaniel)\
**Post date:** [May 26, 2019, 5:23am UTC](https://discourse.julialang.org/t/workflow-question-how-to-guarantee-no-dependence-on-global-state-without-long-load-times/24613/1 "2019-05-26T05:23:29Z")

</div>

This is a question about workflow. I like to code in an exploratory, iterative way, but I generally prefer not to use REPL or notebook environments, because I like to keep everything in a state where even if I get interrupted tomorrow and have to come back to it 6 months later, I can get it running again straight away, without having to remember what I did. (This happens to me regularly.)

In Python, I do this by putting everything in a file `test.py`, and then just call `python3 test.py` at a shell prompt. The code in `test.py` typically imports matplotlib, does some calculations, then pops up a plot window showing the results. When doing things this way, it’s absolutely guaranteed that my code is not accidentally referring to any global state and will run in exactly the same way next time, as long as I use the same version of Python.

I’d like to achieve a similar workflow in julia. However, it’s made complicated by the fact that starting julia and importing Plots takes a good 30 seconds, and Plots doesn’t seem designed to support this kind of workflow. So I am wondering if it’s possible to import/run my file in the REPL, in such a way that it’s guaranteed to be unable to access any global state, without having to wait for Plots to be imported every time it’s run.

I know that I can put my code in a module, and that when I re-include it the module’s namespace will be reinitialised. However, this isn’t enough, because if I’ve understood correctly, this only applies to global variables in my module’s namespace and not other modules’ namespaces. So if some previous iteration of my code has changed some global state stored in Plots or some other module, the current version might not run the same way if the REPL is restarted.

Is there a way to achieve what I’m asking for? Or am I asking the wrong question somehow? How do julia users handle this kind of repeatability issue, in general?

---

_[View the full topic](https://discourse.julialang.org/t/workflow-question-how-to-guarantee-no-dependence-on-global-state-without-long-load-times/24613)._
