0

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?

David G. Stork
  • 41,180
  • 3
  • 34
  • 96
Mateus
  • 1,243
  • 7
  • 14
  • 1
    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? – m_goldberg Jan 25 '19 at 04:31
  • Still doesn't work for me. I didn't understand @m_goldberg. – Mateus 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
  • First I created a notebook and then I saved as a .m file. I think I got it. The error was when every time I saved as a .m file, all the content becomes a commentary (* *). So, a question. Every time that I modify my notebook and save as a .m file I will have to uncomment? – Mateus Jan 25 '19 at 15:35
  • 1
    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
  • Thanks @Kuba. The linked topic solved the problem. – Mateus Jan 28 '19 at 15:52

0 Answers0