Sharing variables between different instance mode sketches

or having a global variable that could be accessed by different instance mode sketches.
I have been looking around but I don’t seem to understand how to do it, any example that could illuminate me?

best!

1 Like

Anything declared using keywords var & function in the global context can be accessed everywhere.

As an example of it, in the sketch below the variable sketches is declared using var in all files but the main 1, and is accessed by the main file:

1 Like

Hello! thanks for the answer!
honestly, that code you posted was difficult for me to understand.
but I did manage to understand better how the namespace on my sketch can be created globally and later be called from another sketch under it’s “name.var”, much simpler than I realised. ! thank you!

2 Likes