How to change reactive variable from another template?

I have a reactive var defined in template 1 and i want to change its status from another template 2 . Could this be possible ? I tried adding the reactive var into Session , but set function is not recognized when called .

ReactiveVars are not attached to any template, but if you do var foo = new ReactiveVar() it will be local to the js file. You could either export/import it, or create a global object that you put your ReactiveVars in (although then you will just have recreated Session)


It could be not the best practice, but you can put a reference to the instance in Template global object. Something like that: on created hook you can do Template.Name.__instance = this or push to one array if it is not unique.
Now, you can define your reactive vars as instance properties, this.reactiveVarName = new ReactiveVar().
Now, wherever you are, you can access to it with Template.Name.__instance.reactiveVarName

Having them global is one solution , but my reactive in a template meant to be related only to that , so i added session var , check if that session has changed , then change status of reactive var in the template .

i am pretty new to meteor (only a couple weeks in) - loving it so much.
the ReactiveVar() <-> Session question did also cost me some time. Eventually I decided to only use Session objects to speed up my learning curve and be able to tackle other issues without worrying about import/exports. However I still do not like the fact that i have ‘so many’ global objects now, but maybe I should not care so much. Is there any best practice on this one?

my understanding:
Session objects = globally accessable
ReactiveVar objects = only available in same js file OR be accessed via explicits import/exports