Global var and reloads

When I develop my addon script, every time I change the code, all is reloaded, and I lost all data in global variables. It’s possible to save data outside my context and that the data persists on code changes / reloads?

Hi,

This is neither supported nor encouraged, but you can probably save your data in a different module, e.g. mitmproxy.ctx. The proper way would be to serialize your state to disk in done() and re-read that.

1 Like

Great! I didn’t know that.

Thanks a lot!