I am following this answer to evaluate certain cells in a separate kernel. I have created a separate kernel called
K2 and have the following MWE:
myvar = 1; DistributeDefinitions[myvar]
Which - I believe - makes the definition of
myvar available in all kernels.
Now I am running e.g.
CellPrint@Cell[BoxData[MakeBoxes[Defer[1 + 1]]], "Input", Evaluator -> "K2"]
which produces a cell
that can be evaluated (in kernel
K2) and yields
2 (unsurprisingly). So far, so good.
Now, if I run
CellPrint@Cell[BoxData[MakeBoxes[Defer[myvar]]], "Input", Evaluator -> "K2"]
is created. But evaluating it still yields only
myvar rather than
1. (The same holds if I omit the
I believe I am misunderstanding the concept of separate kernel evaluation? Ultimately, I want to send not only a variable, but a custom function to