Custom Nodes Variables Not Being Stored I am having an issue while working on a custom node tree. When I create a variable in self on a custom node it is not available in other functions of that class, for example:
from .base_node import  Base_Node
from bpy.types import Node


class Test_Node(Node, Base_Node):
    bl_label = &quot;Test Node&quot;

    def init(self, context):
        self.outputs.new(&quot;tree_mesh_socket_type&quot;, &quot;Tree&quot;)
        self.inputs.new(&quot;tree_socket_type&quot;, &quot;Tree In&quot;)
        self.Test_Bool = False

    def On_Execute(self):
        print(self.Test_Bool)

I get the error:
line 14, in On_Execute
print(self.Test_Bool)
AttributeError: 'Test_Node' object has no attribute 'Test_Bool'

This happens where ever I define the variable, it is only accessible from the function it is created in.
Am I just misunderstanding how the node classes work or is this a bug? Should I be using a different method to store the data?
Thanks for any help.
You need to define it outside of the functions to make it a property of the class. Try adding something like the following before your 'def's :
class Test_Node(Node, Base_Node):
    bl_label = &quot;Test Node&quot;
    
    #Define class-level property
    Test_Bool: bpy.props.BoolProperty() 

    def init(self, context):
        .....etc.

This will define a new class-level property 'Test_Bool' and this should then be available as 'self.Test_Bool' from any of the functions within the class.