I would like to have my library functions update on save so they are immediatly available in my notebook file where the library is imported. Effectively like clicking the "Run All Code" button after saving the library (.wl file) so the updated function is immediatly available in the notebook (.nb file). See picture below.

Image of importing a library file

  • 1
    $\begingroup$ Add this to the Notebook with the library functions SetOptions[InputNotebook[], AutoGeneratedPackage -> Automatic]. $\endgroup$ Commented Jul 3, 2020 at 15:06
  • $\begingroup$ @RohitNamjoshi I am not sure this solution is exactly what I am looking for. I edited my question and added some more details. $\endgroup$ Commented Jul 5, 2020 at 13:01
  • $\begingroup$ I use notebook specific contexts so symbols defined in one notebook are not visible in another notebook even when running on the same kernel. So I use AutoGeneratedPackage which creates the .wl file when the notebook is saved and then I Get the file in the notebook in which I want to use the definitions. $\endgroup$ Commented Jul 8, 2020 at 19:35
  • $\begingroup$ For your use case you can intercept the File / Save menu command and run code to select all input cells and evaluate them. See this. $\endgroup$ Commented Jul 8, 2020 at 19:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.