Help says:
NotebookEvaluate can take either a NotebookObject or a filename referencing a notebook file.
therefore, I wonder why
SetDirectory @ NotebookDirectory[];
nbFile = "aNotebook.nb";
FileExistsQ[nbFile]
NotebookEvaluate[nbFile]
returns
Out[3]= True
During evaluation of In[1]:= NotebookEvaluate::nbnfnd: Unable to find the notebook aNotebook.nb. >>
Out[4]= $Failed
and, on the contrary,
SetDirectory @ NotebookDirectory[];
nbFile = FileNameJoin @ {Directory[], "aNotebook.nb"};
FileExistsQ[nbFile]
NotebookEvaluate[nbFile]
returns
True
It looks like NotebookEvaluate
could not take relative paths; even worse, the notebook aNotebook.nb
contains simply
f[x_]:=x+1;
but, even in the latter case, the function f
remains undefined.