I'm new in python. I have two py files like this: A.py
class LLL(object):
pass
ak=LLL()
print(ak)
def f1():
from B import tt
print("hello")
if __name__=="__main__":
f1()
and B.py
from A import ak
def tt():
print("sss")
print(tt)
when i run A.py,i get the console below:
<__main__.LLL object at 0x0000000000B69BE0>
<A.LLL object at 0x0000000001461668>
<function tt at 0x000000000124AD90>
hello
My question is why ak create twice?In B.py,i want to get the ak created in A.py,not create a new ak,it looks like import B will run all A's code,how can i fix it?