# How to load a package [duplicate]

I have a package:

BeginPackage["HNotation"];

soma::usage = "asdfa";

Begin["Private`"];

soma[x_] := x + 1;

End[];

EndPackage[];

I save the file with ".m" extension. So, in another file I tried to load the package:

In[2]:= Get["MPA_HNotation.m", Path -> {"/home/mateus/Desktop/"}]

In[3]:= soma[x]

Out[3]= soma[x]

It seems that doesn't get the package. What can be wrong?

• Works fine for me, maybe there are old definitions of soma that interfere. Get would issue a message if it didn't find the file. What if you restart the kernel. What does ?soma say?
– Kuba
Jan 24 '19 at 21:24
• Did you remember to make all the cells you want evaluated when your package loads the Initialization Cell property? Jan 25 '19 at 4:31
• Still doesn't work for me. I didn't understand @m_goldberg. Jan 25 '19 at 13:59
• @Mateus how did you create .m file? What is the raw content of the file?
– Kuba
Jan 25 '19 at 15:28
• No, you need to have Code cells. If you create a new .wl file it will have them by default. See linked topic and let me know if you disagree with closing.
– Kuba
Jan 28 '19 at 14:39