How to initialize a variable which won't be refreshed I am coding a node for animation nodes. I need to initialize a set of variables so I can use them, but I need to do it in such a way that they won't be refreshed (reset to the default value) every time I send an output to the node.

I probably want to define the variables before my create(self) method, so it won't refresh every time I send/receive I/O from the execute(self,a,b,...) method.

I have this:

    def create(self)
       new.Input(...)
       new.Input(...)
       new.Output(...)
       etc...

def execute(self,a,b,etc..)
   loops involving variables.


Where do I define my variables, and what is the syntax for calling them to check or change values without resetting them to their default start settings?
You can define such variable outside of the node class and call it as you would call a global variable. Take the Text File Reader node for example, it defines a cache dictionary to cache file reads, the cache is initially defined outside of the class as:

cache = {}

class TextFileReaderNode(bpy.types.Node, AnimationNode):
    bl_idname = "an_TextFileReaderNode"
    bl_label = "Text File Reader"
    ...


And it assign and read the cache in the execute function normally:

with open(path, "r", encoding = encoding) as f:
    data = f.read()
    cache[key] = (lastModification, data)
    ...


You can also use the node identifier as a key in the dictionary to have a per-node variables. For instance, if you want a variable xBounce for every node, create an empty dictionary called xBounce and in the execution function, set its value using xBounce[self.identifier] = something and retrieve its value using xBounce.get(self.identifier, 0) where zero is the default value