# Print definition of functions of user created Mathematica Packages

To expedite the work I do I have created a Mathematica Package that has all the functions I need to plot the data I need to analyze.

The problem is every now and then I will need to slightly modify one of the functions and will need to go and look for the .m package, copy the function onto the notebook, change the name, and work from there. I was wondering if there is any way that I could create a function inside the Package that would print the contents of the functions so I don't have to lose time searching. Something like PrintFunPac[Function1] that would return the definition of Function1.

Tried googling and didn't find anything. Thanks!

You can always enter

?? <packagename>*


where <packagename> is the name of the package/context you want to inspect.

For example

?? Developer*


contains many useful symbols.

For deeper hidden symbols, you can also try

?? <packagename>**


Another helpful tool is hidden in the package "GeneralUtilities". Run the following and be amazed:

Needs["GeneralUtilities"]
PrintDefinitions[HoldPrint];

• Thank you so much!. The first thing you said ?? <packagename>*  did return the definition of the functions but with the packagenamePrivate  in front of the variables' name, but your solution of Needs["GeneralUtilities"]; PrintDefinitions[HoldPrint]; worked!! Thank you so much! – M.O. Sep 12 '18 at 18:47
• You're welcome! – Henrik Schumacher Sep 12 '18 at 18:51
• @M.O. I think it is not clear what is the goal. Your question suggested you want to access the code and edit it but PrintDefinitions creates notebooks that are not ready to play with. Or is preview code the main goal? – Kuba Sep 13 '18 at 10:41
• @Kuba, I thought I had been pretty straightforward but I guess not. The package I have created is done, but as the input data changes and the images are needed for different purposes, every now and then I need to change the functions of the package a bit. I was asking a way to get the definition of the function of my package, meaning the code, from mathematica instead of searching for the .m, copying the function, pasting it in the .nb, changing its name and then make the changes. Using Needs["GeneralUtilities"]; PrintDefinitions[HoldPrint];` as Henrik suggested did just that. – M.O. Sep 13 '18 at 13:02
• @M.O. Huh! Yeah, that works. Great! So I also learned something here! =D – Henrik Schumacher Sep 13 '18 at 13:18