tmp cat py None def get_a print def set_a val global val tmp cat py __

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
/tmp ξ cat a.py
a = None
def get_a():
print(a)
def set_a(val):
global a
a = val
/tmp ξ cat b.py
a = __import__('a')
a.get_a()
a.a = 5
a.get_a()
a.set_a(6)
print(a.a)
/tmp ξ python b.py
None
5
6