# How to get the global variables?

**URL:** https://discourse.julialang.org/t/how-to-get-the-global-variables/10748
**Category:** General Usage
**Created:** [May 6, 2018, 9:39pm UTC](https://discourse.julialang.org/t/how-to-get-the-global-variables/10748 "2018-05-06T21:39:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)
#### Post date: [May 6, 2018, 9:39pm UTC](https://discourse.julialang.org/t/how-to-get-the-global-variables/10748/1 "2018-05-06T21:39:16Z")

</div>

Hi,  
I was looking for a function, which gives the global variables available within the scope?

Is there such a function.

Thanks.

---

<div class="post-metadata">

### Author: ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)
#### Post date: [May 6, 2018, 9:43pm UTC](https://discourse.julialang.org/t/how-to-get-the-global-variables/10748/2 "2018-05-06T21:43:15Z")

</div>

```julia
help?> whos                                                                                                                                                              
search: whos print_with_color                                                                                                                                            

  whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"")                                                                                                    
                                                                                                                                                                         
  Print information about exported global variables in a module, optionally restricted to those matching pattern.                                                        

  The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object.

```

---

<div class="post-metadata">

### Author: ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)
#### Post date: [May 6, 2018, 9:43pm UTC](https://discourse.julialang.org/t/how-to-get-the-global-variables/10748/3 "2018-05-06T21:43:46Z")

</div>

Thanks you are awesome.!

---

<div class="post-metadata">

### Author: ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)
#### Post date: [May 6, 2018, 9:46pm UTC](https://discourse.julialang.org/t/how-to-get-the-global-variables/10748/4 "2018-05-06T21:46:27Z")

</div>

I have one question though.

```nohighlight
module DFT
           global a
           export f
           f()=44
       end

whos(DFT)
                           DFT 1540 bytes Module
                             f 0 bytes DFT.#f

```

why is :a not present in the output?

---

<div class="post-metadata">

### Author: ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)
#### Post date: [May 7, 2018, 4:31am UTC](https://discourse.julialang.org/t/how-to-get-the-global-variables/10748/5 "2018-05-07T04:31:13Z")

</div>

~~Each module defines its own, separate scope: [https://docs.julialang.org/en/stable/manual/variables-and-scoping/#Global-Scope-1.~~](https://docs.julialang.org/en/stable/manual/variables-and-scoping/#Global-Scope-1.~~) Edit: I misread. I guess `whos` chooses to only display exported variables, as stated in its doc: “Print information about exported global variables in a module”.
