I want to aoutoload a package at the beginning of a notebook. I set up my directory as written here

How to use the Autoload directory?

So, I have these files:




MyPack.m :


BeginPackage[ "Progetto`"]








In MyFile.nb, I would like use Prova[], but the output isn't 6 but is Prova[].

Where am I wrong? Am I missing something in init.m?

  • $\begingroup$ Is Progetto` in $Packages after kernel launch? And in $ContextPath? $\endgroup$
    – Kuba
    May 4, 2017 at 8:41
  • $\begingroup$ @Kuba Progetto isn't a file. Should I rename "Progetto" in "MyPack"? $\endgroup$
    – Ale1794
    May 4, 2017 at 8:45
  • $\begingroup$ I thought that "Progetto" was the name of the Package $\endgroup$
    – Ale1794
    May 4, 2017 at 8:49
  • $\begingroup$ $Packages contains context that were exported so if MyPack was loaded then Progetto` should be there. $\endgroup$
    – Kuba
    May 4, 2017 at 8:50
  • $\begingroup$ @Kuba no, in $Packages there isn't Progetto $\endgroup$
    – Ale1794
    May 4, 2017 at 8:56

1 Answer 1


I want to aoutoload a package at the beginning of a notebook.

In this case, create an initialization cell in the notebook, and load that package in that cell. Select the cell, and tick Cell menu -> Cell Properties -> Initialization Cell.

"Autoloading" refers to loading something on kernel startup, and is completely independent of notebooks. This is not what you need.

So, I have these files:



The Autoload directory I wrote about in the answer you are linking to is located in $UserBaseDirectory. There is only one* such directory, and it is used on kernel startup. It does not interact with notebooks in any way.

* To be completely accurate, there are a few, but they all live in fixed locations, such as $UserBaseDirectory, $BaseDirectory, $InstallationDirectory/SystemFiles, etc.


Your Answer

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

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