def fun1():     fun1.var = 100     print(fun1.var)  def fun2():     print(fun1.var)  fun1() fun2()  print(fun1.var) 

Read more of this post