Canvas computation order

Does anyone what order the canvas computes components? is it location/stream start based?

example, i have (3) streams, which one is computed first?

there may be a better way of doing this but my specific case I’m defining a sticky dictionary that is a single component that i need to initialize when the snippet is brought onto the canvas. several components will read the initialized value.

in my experience whichever plopped onto the canvas first gets computed first

As Will_Wang says, it’s the order of when it was placed on the canvas.

Do you know of a way to consistently “force” a component to run first? The Ctrl +B issue seems to work but doesnt seem very reliable

If they’re Python components all importing a common library, the library’s setup code will run whichever component imports it first (the objects therein are cached in sys.modules for subsequent components).

I use that pattern together with a launcher to process external config options that apply to all components, and to initialise the logging handlers, before any of the code proper runs.

Generally, I feel component execution order is the Grasshopper user’s prerogative. It’s a bit more complicated with shared state and side effects, but plug-ins should be designed such that given a valid set of inputs, their components will still work correctly, whatever order the user chooses to run them in.

If you yourself are the only user, then I think there’re various events that can be listened too, that can trigger handler functions. But the behaviour of a grasshopper worksheet using such components, starts to get astonishing then.