I'm trying to do something where I see too many paths to a solution and am paralyzed trying to figure out the best route to take.
My blocks are creating methods in a class so there are normal variables within those methods but there are also class variables which are generated like 'self.<var_name>_val'
I've got something that works okay using a dynamic flyout and custom variables like:
{
"type": "class_var_get",
"message0": "self.%1",
"args0": [
{
"type": "field_variable",
"name": "VAR",
"variable": "",
"variableTypes": ["ClassVar"],
"defaultType": "ClassVar"
}
],
"output": null,
"colour": 35,
"tooltip": "Accessor for class variables.",
"helpUrl": ""
},
{
"type": "class_var_set",
"message0": "set self.%1 to %2",
"args0": [
{
"type": "field_variable",
"name": "VAR",
"variable": "",
"variableTypes": ["ClassVar"],
"defaultType": "ClassVar"
},
{
"type": "input_value",
"name": "VALUE"
}
],
"previousStatement": null,
"nextStatement": null,
"colour": 35,
"tooltip": "Setter for class variables.",
"helpUrl": ""
}

The problem is that these now all have a type of 'ClassVar' which means they can't be used dynamically like regular Python variables. For example these vars might be strings or ints or whatever so I'd like to use them in blocks that take numbers and text but they get rejected in some cases because the type doesn't match. I defeated SOME of that by removing "check": "ClassVar" from the setter which allows anything to be assigned to them but the getter still has the problem.
I'm now deep down a rabbit hole looking at overriding behavior of field_dropdown or subclassing field_variable but they all seem problematic. The biggest issue seems to be a chicken and egg one. How do I store the list of class variables to dynamically populate the dropdown?
I'm hoping someone has a suggestion I'm sure there's an optimal way to do this but most of the paths I'm looking down seem fairly complicated so I don't want to run off in the wrong direction.
cheers,
Chris