0
$\begingroup$

This question already has an answer here:

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?

$\endgroup$

marked as duplicate by Szabolcs, Kuba Jan 28 at 14:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ 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? $\endgroup$ – Kuba Jan 24 at 21:24
  • $\begingroup$ Did you remember to make all the cells you want evaluated when your package loads the Initialization Cell property? $\endgroup$ – m_goldberg Jan 25 at 4:31
  • $\begingroup$ Still doesn't work for me. I didn't understand @m_goldberg. $\endgroup$ – Mateus Jan 25 at 13:59
  • $\begingroup$ @Mateus how did you create .m file? What is the raw content of the file? $\endgroup$ – Kuba Jan 25 at 15:28
  • 1
    $\begingroup$ 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. $\endgroup$ – Kuba Jan 28 at 14:39

Browse other questions tagged or ask your own question.