# How to set a property in the current module

**URL:** <https://discourse.julialang.org/t/how-to-set-a-property-in-the-current-module/75416>\
**Category:** New to Julia\
**Created:** [January 29, 2022, 1:54pm UTC](https://discourse.julialang.org/t/how-to-set-a-property-in-the-current-module/75416 "2022-01-29T13:54:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![taotree](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/taotree/32/31982_2.png) [@taotree](https://discourse.julialang.org/u/taotree)\
**Post date:** [January 29, 2022, 1:54pm UTC](https://discourse.julialang.org/t/how-to-set-a-property-in-the-current-module/75416/1 "2022-01-29T13:54:11Z")

</div>

If I call `setproperty!(anymodule, sym, val)` it gives an error `cannot assign variables in other modules`. Does that suggest I can assign variables in the current module? But if so, how? This `setproperty!(NameOfCurrentModule, sym, val)` still gives the same error.

And maybe the same question: is there some way to reference the current module in a general way (not by specific name)?

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [January 29, 2022, 3:09pm UTC](https://discourse.julialang.org/t/how-to-set-a-property-in-the-current-module/75416/2 "2022-01-29T15:09:43Z")

</div>

I think this is what you want?

```julia
@eval $sym = $val

```

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [January 29, 2022, 3:11pm UTC](https://discourse.julialang.org/t/how-to-set-a-property-in-the-current-module/75416/3 "2022-01-29T15:11:19Z")

</div>

And `@ __MODULE__ ` is the current module.
