This question already has an answer here:

I wanted to ask a simple question. I am new to Mathematica, and I don`t find a way to call user defined functions just as I call Mathematica functions.

I want to use my own defined functions, but call them from different notebooks without including them in each notebook.

Is it possible? Thanks!


marked as duplicate by user9660, Mr.Wizard Feb 10 '16 at 18:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Add your function definitions to the init.m file. $\endgroup$ – Bob Hanlon Feb 10 '16 at 17:52
  • $\begingroup$ (8221) $\endgroup$ – Mr.Wizard Feb 10 '16 at 18:04

One way to do it is the following. Evaluate in a Mathematica notebook the following

$UserBaseDirectory <> "/Kernel"

Go to the corresponding file and create through Mathematica (if it is not already existing) an init.m file with your definitions e.g.

  • $\begingroup$ Thanks it helps a lot (sorry for the duplicate, I hadn't found it) $\endgroup$ – Miguel Feb 10 '16 at 20:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.