Python: Access members of a function from outside that function : <p>Say I had two functions, one belonging to another like so.</p>

<pre><code>def foo():
    def bar():
        print("im bar")
    print("im foo and can call bar")
print("i can call foo, but not bar?")
</code></pre>

<p>How would refer to or call bar?
Would I do <code>foo.bar()</code>?</p>

<p>If <code>bar</code> were not a function like if <code>bar = 1</code> then how would I access that?</p>

<p>I'm aware I could move <code>bar</code> out of <code>foo</code> but is there any other way?</p>
