I'm developing a wox plugin using python.
I found the attribute of object of Main class will be initialized everytime when method query is invoked.
Take an example:
class Main(Wox):
attr = 1
def query(self):
with open('log.txt', 'a+') as logFile:
logFile.write(str(self.attr))
logFile.flush()
self.attr = 2
And you will get only '1' everytime you do a query using wox. I guess wox create Main object everytime user does a query. Is that right?
If so, could any one tell me how to remain cache-like, stateful variable?
Thanks a lot!
I'm developing a wox plugin using python.
I found the attribute of object of
Main
class will be initialized everytime when methodquery
is invoked.Take an example:
And you will get only '1' everytime you do a query using wox. I guess wox create
Main
object everytime user does a query. Is that right?If so, could any one tell me how to remain cache-like, stateful variable?
Thanks a lot!