My problem is that the second notebook file opens but waits for the first notebook to be evaluated. I want to execute both file1.nb and file2.nb at the same time. Here is my code. any idea?
NotebookPauseForEvaluation[nb_] := Module[{},
While[NotebookEvaluatingQ[nb], Pause[1]]
];
NotebookEvaluatingQ[nb_] := Module[{},
SelectionMove[nb, All, Notebook];
Or @@ Map["Evaluating" /. # &, Developer`CellInformation[nb]]
];
UsingFrontEnd[
nb1 = NotebookOpen["./file1.nb"];
SetOptions[nb1, Evaluator -> "RemoteKernel1"];
SelectionMove[nb1, All, Notebook];
SelectionEvaluate[nb1];
NotebookPauseForEvaluation[nb1];
NotebookSave[nb1];
nb2 = NotebookOpen["./file2.nb"];
SetOptions[nb2, Evaluator -> "RemoteKernel2"];
SelectionMove[nb2, All, Notebook];
SelectionEvaluate[nb2];
NotebookPauseForEvaluation[nb2];
NotebookSave[nb2];
];
Evaluation > Notebook's Kernel
. Note, however, that your license may limit the number of kernels running simultaneously. $\endgroup$Evaluation > Notebook's Default Context > Unique to This Notebook
. $\endgroup$Unique to This Notebook
. $\endgroup$