# Getting variables defined with "global"

**URL:** <https://discourse.julialang.org/t/getting-variables-defined-with-global/10751>\
**Category:** General Usage\
**Created:** [May 7, 2018, 3:29am UTC](https://discourse.julialang.org/t/getting-variables-defined-with-global/10751 "2018-05-07T03:29:41Z")\
**Posts on this page:** 2\
**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 7, 2018, 3:29am UTC](https://discourse.julialang.org/t/getting-variables-defined-with-global/10751/1 "2018-05-07T03:29:41Z")

</div>

Hi fellows,

I am having difficulty getting the globally defined variables within a module.

Here is an example:

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

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

```

:a is not present in the output.  
Thanks

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [May 7, 2018, 4:34am UTC](https://discourse.julialang.org/t/getting-variables-defined-with-global/10751/2 "2018-05-07T04:34:07Z")

</div>

What about `names(DFT, true)`?

```julia
help?> names
search: names fieldnames dirname tempname fullname basename TypeName fieldname module_name getsockname gethostname

  names(x::Module, all::Bool=false, imported::Bool=false)

  Get an array of the names exported by a Module, excluding deprecated names. If all is true, then the list also includes non-exported names defined in the module, deprecated names, and compiler-generated names. If imported is true, then
  names explicitly imported from other modules are also included.

  As a special case, all names defined in Main are considered "exported", since it is not idiomatic to explicitly export names from Main.

```

If you look at the implementation of `whos`, [perhaps with `@edit whos()`], you’ll see it calls `names()` without the optional arguments. So there’s an opportunity for you to customise `whos`, or perhaps a PR with keyword args?
