I thought I saw a recent thread on this topic but can’t find it,
Here is an old one, easily replicated in Python?
public class Script_Instance : GH_ScriptInstance
{
#region Utility functions
#region Members
private void RunScript(bool x, bool reset, ref object A)
{
if(reset) counter = 0;
if(x) counter++;
A = counter;
}
int counter;
}