Refer to variable names between two codeblock nodes

Is it possible to refer to variables between two codeblock nodes? I’d like to define some points/ lines or other values and store them in variables that need to be referred to throughout the dynamo graph. Please guide if there is a way. Thank you.

Unfortunately this is not possible.

If you’re “manually” defining those variables you can create them as a function and call that function from any node. But you cannot dynamically define values in a function. Or you can use invisible wire connections to make them look disconnected.

1 Like

Thank you Nick, will have to see to work around using function calls.

Hi @vcat ,

I think there are some nodes that do this, but I strongly recommend showing where data is coming from and where it is used, since this keeps the script understandable for others and easier to understand when accessing a script after a long time.

What I do in these situations is keep a “dataline” above or below the calculations which has branches whenever the data is needed. For example:


Thanks @Daan I just understood what you meant. Yeah it’s a literal “work around” :slight_smile: