It sounds like the best solution to your problem might be to just create a package file (a plain text file with .m extension) containing the initialization commands and read in that package file with Get[]. The simplest way to do this is the following:
- Open the notebook containing the initialization cells
- Go to Format -> Option Inspector
- In the first drop-down choose "Selected Notebook" and type AutoGeneratedPackage in the search box
- Set the option value for AutoGeneratedPackage to Automatic
- Now save the notebook. From now on whenever you save the notebook the contents of the initialization cells will be written into a package file located in the same directory as the notebook.
That said, it is possible to
programmatically invoke any menu function and evaluating the initialization cells is available in the Evaluation menu. But I'm not sure this is a
good solution to your
actual problem.