Human Layertable not updating

Hello!

I am working on a script that outputs g-code based on the Rhino layers and their geometry. I need the script to be dependent on the order of the layers, which i have achieved based on the “Layer Table” component from the Human plugin. But they do not update whenever i change the order. Only on a full reboot of Rhino and GH.

I still work with Rhino 7, if that means anything.
Script is attached:
20240407 - CNC GH script_MKH V2_6.gh (91.6 KB)

Also a test file (Both in Rhino 7 & 8):
P2_side_MKH_RH7.3dm (3.3 MB)
P2_side_MKH_RH8.3dm (3.3 MB)

I’ve tried to make a python component that would output both the layer structure and their visibility, but it won’t update either.

import Rhino
import Grasshopper

# Global variable to hold previous layer info
previous_layer_info = []

def get_layers_info():
    # Get the current layers in the active Rhino document
    layers = Rhino.RhinoDoc.ActiveDoc.Layers
    layer_names = []
    layer_visibility = []
    
    for layer in layers:
        layer_names.append(layer.Name)          # Store layer names
        layer_visibility.append(layer.IsVisible) # Store layer visibility status
    
    return layer_names, layer_visibility

def update_layer_info():
    global previous_layer_info
    # Get the current layer info
    layer_names, layer_visibility = get_layers_info()
    
    # Create a tuple of current layer info for comparison
    current_layer_info = list(zip(layer_names, layer_visibility))
    
    # Check for changes
    if current_layer_info != previous_layer_info:
        previous_layer_info = current_layer_info  # Update previous info
        return layer_names, layer_visibility
    return None, None

# Initial call to get layer info
layer_names, layer_visibility = get_layers_info()
a = layer_names          # Output for layer names
b = layer_visibility      # Output for layer visibility status

# Store the initial layer info for comparison
previous_layer_info = list(zip(layer_names, layer_visibility))