Imagine I have 2 notebooks with the following contents:
Notebook 1: "notebook1.nb"
a1 = 1;
f1[x_, y_, z_] := x + y + z;
Print[f2[2, 1]];
Notebook 2: "notebook2.nb"
a2 = 2;
f2[x_, y_] := x - y;
Print[f1[1, 2, 3]];
Print[a1 + a2];
What do I have to do that the notebooks can share variables and functions with each other?
.m(or.wl) extension and load it usingGet. – Szabolcs Dec 15 '16 at 12:15something.m. To evaluate all expressions in the file, useGet["something.m"](you may need to specify the full path). – Szabolcs Dec 15 '16 at 12:21NotebookEvaluate(since version 10.0, I think). But I still maintain that plain text.mfiles are much better for this purpose. – Szabolcs Dec 15 '16 at 12:23Print. You will find that you don't needPrint– m_goldberg Dec 15 '16 at 17:04