Is it possible to call functions from other notebooks in Mathematica, and if so how can I do it?
Unless you specify otherwise, each notebook contributes to the Global`
context. So, to call a function in notebook a
from notebook b
: first ensure that the definition is loaded into the context (i.e. select the cell with the definition and hit shift-enter), and then the definition is available to notebook b
, and any other notebooks you have open.
To prevent this behavior, you can change the Notebook's Default Context from the Evaluation
menu. There are four options: Global`
(the default), another specified context, unique to the notebook, unique to the cell group. For the cell group, each input cell takes the context of the nearest enclosing group, e.g. a Subsection, for instance, and those groupings have unique contexts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With