I'm looking to access variables in different contexts. The contexts are stored in a list labeled contexttable
. Each context, of course, is a string. Is there any way, without using NotebookWrite
, to access a variable of the same name, say x
, in each context?
I am looking for something like
contexttable = {"Context1`", "Context2`", ..., "ContextN`"};
Map[Print[# <> x]&, contexttable]
which would print the x
variable in each context.
Symbol
orToExpression
in the docs. Be aware that if the variable you reference does not exist, you will create a new symbol by using those. $\endgroup$