How can I add attributes to a module at run time?

前端 未结 7 1726
逝去的感伤
逝去的感伤 2021-01-03 22:04

I have a need to add module attributes at run time. For example, when a module is loaded, it reads the file where the data is contained. I would like that data to be avail

7条回答
  •  不知归路
    2021-01-03 22:45

    Just set it.

    my_object = MyObject()
    my_object.my_custom_attribute = 'my_value'
    

提交回复
热议问题