title: How do you check if a variable is defined inside a module in Julia?
body: <p><code>isdefined(:x)</code> will tell you if a variable x is defined in your current workspace.</p>
  
  <p>If I want to check a variable is defined in a module (not one that's exported), how can I do that? I tried all of the following:</p>
  
  <pre><code>julia&gt; module Test
         x = 1
         end
  Test
  
  julia&gt; x
  ERROR: UndefVarError: x not defined
  
  julia&gt; isdefined(:x)
  false
  
  julia&gt; Test.x
  1
  
  julia&gt; isdefined(:Test.x)
  ERROR: type Symbol has no field x
  
  julia&gt; isdefined(:Test.:x)
  ERROR: TypeError: getfield: expected Symbol, got QuoteNode
  
  julia&gt; isdefined(Test.:x)
  ERROR: TypeError: getfield: expected Symbol, got QuoteNode
  </code></pre>
  
  <p>In the module Test above, I want to check if x is defined or not. </p>