@Mohammad I am not sure an actual scope is available for variables but if you know a variable exists and is in use such as through variables operator and dumpvariables macro or the actionlog to peek inside variables, within in actions, there are other searches you can undertake to find where they are defined. More often than not the name of the variable itself will be the clue as to where it originated.
I can help a lot here but must ask why you ask this question, what do you hope to achieve?
- I have built other tools that specifically search for macro/variable definitions
See my-custom-dumpvariables.json (672 Bytes) that collapses the dumpvariables and provides a subfilter this is more practical than the dumpvrariables macro on its own to insert in code. This along with the actionlog should give you visibility of variables in most places.
However as you know variables can be defined as needed such as in a recursive process it may be defined and set for each recursion, in which arguably the scope is within the DOM or virtual DOM (not that I am expert here) that tiddlywiki uses such that you may be able to get some information using the Internals plugin and Previews Parse and Widget trees.