I am trying to make an Object in Python that will persist, meaning it will last longer than just while the DAT containing its class is run.
Right now I have the following in a Text DAT:
class Thing:
def __init__(self, collecting=False, list_list=[], new_list=[]):
self.collecting = collecting
self.list_list = sysex_list
self.new_list = new_list
[/code] (not sure why the underscore is not appearing there)
This allows me to make a "Thing" in another DAT, like a execute or whatever, by saying:
[code]import text1
thing = text1.Thing()
thing.collecting = True
Okay great. However, after the execute DAT has run, the “thing” instance no longer exists. I can not go back and change that specific instance’s new_list attribute.
I am specifically interested in making an object where its attributes will be set in real time by CHOPs. How can I make this object last like it would if I just typed the code straight into the textport?