I have class in file api.py that contains property:
class API(object):
api_key = ''
def add_advert(self):
print(self.api_key)
In another class I use import class above:
import api
api = api.API()
Then in class I try to write value into property api_key:
api.api_key = 'NEW VALUE'
So, when I call another method from api class:
api.add_advert()
It does not return me new value for api_key:
def add_advert(self):
print(self.api_key)
My final code is:
import controller.api
apiClass = controller.api.API()
When I try to set:
apiClass.api_key = 'NEW VALUE'
It gives me :
'NoneType' object has no attribute 'api_key'