Passing a variable through a function?

This may be a dumb question but is it possible to send a variable that was set by another node through a function?



Your function has no arguments, so it returns null.



Thank you

i tried this parallel

1 Like

@Organon and Draxl_Andreas
This is close but not quite what I am looking for. The variable Elem is being set by the 1st code block which is being passed to the 3rd codeblock which is then sent to the function to return itself. What I am trying to do is set the variable in the second code block by the first one and see if can pass that variable through the function without connecting the 2nd code block to the 3rd code block.

Try the Springs package by @Dimitar_Venkov, which has some awesome Utility nodes!


Thanks for the tip I will give it a shot.

1 Like

There are no global variables between code blocks, so it is necessary to use an argument to pass a value through the function. If you don’t want to connect the nodes, you can write all your code in a single code block.

Thank you, I think that conclusion I was coming to as well. I was hoping for a global variable but it doesn’t look like I can set it that way.

I believe that Dynamo 2.13 allows hiding wires which will help get the desired outcome.

Also, you can use the Springs package, or set a variable in an external file or a spot in memory (the clipboard is a good use for this) and call for that.

1 Like

You can have a global static, but not a global variable.