3 ms·
Here's another way to do it: >>> def foo(): ... import __main__ ... a = __main__.a ... print(a) ... >>> foo() 1
by gilch 4y ago
Here's another way to do it:
>>> def foo():
... import __main__
... a = __main__.a
... print(a)
...
>>> foo()
1