Suppose Notebook A calls NotebookEvaluate[Notebook B]. Notebook B calls NotebookDirectory[]. Naturally, NotebookDirectory[] returns the directory of Notebook B. Is there an option to have NotebookDirectory[] return the directory of Notebook A?

  • 3
    $\begingroup$ If you select Notebook A before evaluating NotebookEvaluate[Notebook B], then you can get the directory of Notebook A in Notebook B by dirA = NotebookDirectory[SelectedNotebook[]], but I would not really do this at all. Just use .m or .wl files and DirectoryName[$InputFileName]. Extended programming should not be done in notebooks, I think. $\endgroup$ – Rolf Mertig May 9 '20 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.