I can run API.py, but not the APP.py in the same directory. The error is "NameError: name 'a' is not defined". Is global() really global?
API.py:
class Entity():
def __init__(self,name,value):
globals()[name]=value
if __name__ == '__main__':
Entity('a',1)
print(a)
APP.py
from API import Entity
if __name__ == '__main__':
Entity('a',1)
print(a)