# If there a getvariable() equivalent for expressions?

**URL:** <https://discourse.julialang.org/t/if-there-a-getvariable-equivalent-for-expressions/1857>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [February 2, 2017, 10:35pm UTC](https://discourse.julialang.org/t/if-there-a-getvariable-equivalent-for-expressions/1857 "2017-02-02T22:35:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adowling2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adowling2/32/539_2.png) [@adowling2](https://discourse.julialang.org/u/adowling2)\
**Post date:** [February 2, 2017, 10:35pm UTC](https://discourse.julialang.org/t/if-there-a-getvariable-equivalent-for-expressions/1857/1 "2017-02-02T22:35:37Z")

</div>

I like to build modular optimization models using functions. Occasionally, I will add a variable in one function and then bring it into scope in another function using getvariable(). Is there an equivalent feature for expressions?

In summary, I would like to add an expression to a JuMP model in one scope and use it in another.

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [February 2, 2017, 10:42pm UTC](https://discourse.julialang.org/t/if-there-a-getvariable-equivalent-for-expressions/1857/2 "2017-02-02T22:42:02Z")

</div>

No, that functionality does not exist. PRs accepted.

---

<div class="post-metadata">

**Author:** ![ccoffrin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccoffrin/32/400_2.png) [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Post date:** [February 3, 2017, 12:56am UTC](https://discourse.julialang.org/t/if-there-a-getvariable-equivalent-for-expressions/1857/3 "2017-02-03T00:56:56Z")

</div>

I have used the model ext dictionary to store expressions I want to get at later.
