Node's output in a global variable

does anyone have an idea how to store the output of certain node in a global variable?

If you’re talking about within Dynamo itself (not a global parameter in Revit) then it’s not currently possible. You can write a function to return a static value but you can’t use inputs when writing a function.

1 Like

use a function that writes to a dictionary.

1 Like

in Dynamo it self and i want the output of a certain node…the return of a function cant be a node’s output.
i have tried to do it with functions but i didn’t succeed.

Assuming you have a non-complex data type, you can write to a CSV in the temp directory and use that as an external dictionary to store your values.


I don’t understand this point. the return value of a function can of course be a node’s output value. What are you trying to do?

1 Like

On the left side of my script (pretty big script) is my inputs, i want to show some analytical data nearby the inputs without creating nodes connections between the end the the beginning of the script.
i know how to return a string from a function but thats not what i need i do need to add the values from some node to a variable…
for now i think i will accept the one from #JacobSmall as a solution.
but i think it would be nice to store the value you need in a variable like in c# for example…
thanks for all

That’s actually pretty easy and pretty slick. You’re limited to basic object types but that’s a given.

1 Like

I don’t have access to dynamo right now, but -
why not do something like this:
(this is pseudo code)

x= {};
def staticDict(){
return x;

def storeValue (varName, value)
 staticDict()[varName] = value;

def getValue(varName){
    return staticDict()[varName];    
1 Like

Or if you have something other than strings. Just use spring nodes. :grin:


Great ideas guys, thanks

hello Michael, I’m trying to implement this code,
but I don’t quite get it working,

have you ever managed to make it works?

Hello Nick,

Did you put something in your Python nodes?
I have tried and it doesn’t work

I followed Jacob’s suggestion of writing to a CSV. It’s a little higher up in the thread.