0
votes

I have a Mathematica function that calls NotebookEvaluate, but the notebook being evaluated needs variables defined in the workspace of the notebook from which the function is defined and called. How can I make the variables defined in the notebook that calls the function available to the notebook being evaluated by NotebookEvaluate?

Thanks in advance, Ed Hall

1

1 Answers

0
votes

Shouldn't be a problem accessing variables from outside the evaluation notebook, for example below.

Clear[x]
x = 2;
nb = CreateDocument[ExpressionCell[Defer[x^2], "Input"]];
NotebookEvaluate[nb]
x = 3;
NotebookEvaluate[nb]

4

9