Heres simplified situation
class Aclass: some_dict = dict() def __init__(self): type(self).some_dict.append("something")
from a import Aclass class Bclass: def __init__(self,obj_a): print(Aclass.some_dict)
from a import Aclass from b import Bclass if __name__ == "__main__": obj_a = Aclass obj_b = Bclass(obj_a)
Im getting error like:
File a.py line 5 AttributeError: type object 'AClass' has no attribute 'some_dict'
submitted by /u/domanpanda
[link] [comments]
r/learnpython Heres simplified situation a.py class Aclass: some_dict = dict() def __init__(self): type(self).some_dict.append(“something”) b.py from a import Aclass class Bclass: def __init__(self,obj_a): print(Aclass.some_dict) main.py from a import Aclass from b import Bclass if __name__ == “__main__”: obj_a = Aclass obj_b = Bclass(obj_a) Im getting error like: File a.py line 5 AttributeError: type object ‘AClass’ has no attribute ‘some_dict’ submitted by /u/domanpanda [link] [comments]
Heres simplified situation
class Aclass: some_dict = dict() def __init__(self): type(self).some_dict.append("something")
from a import Aclass class Bclass: def __init__(self,obj_a): print(Aclass.some_dict)
from a import Aclass from b import Bclass if __name__ == "__main__": obj_a = Aclass obj_b = Bclass(obj_a)
Im getting error like:
File a.py line 5 AttributeError: type object 'AClass' has no attribute 'some_dict'
submitted by /u/domanpanda
[link] [comments]