# Function working in command line session but not in package [duplicate]

I have this pretty straight-forward function

GetMinimum[function_, xmin_] := First[FindMinimum[{function, x>xmin}, x]]


that works perfectly within a Mathematica command line session. However after moving that code into a package and calling it like

GetMinimum[x^2, -20]


I get the following output:

{y=x^2, UniversalPlotPrivatex\$515 > -20}


where UniversalPlot is the name of the package. I cannot figure out how to make the function work when defining it in the package. Any ideas?

• I think it is a duplicate of mathematica.stackexchange.com/q/114769/5478 let me know if you disagree with closing. Or if there are any doubts. – Kuba May 29 '17 at 13:53
• Actually I don't understand how to apply the answer to the linked question to solve my problem. – user3075898 May 29 '17 at 15:17
• e.g GetMinimum[function_, {x_, xmin_}] := First[FindMinimum[{function, x>xmin}, x]]? – Kuba May 29 '17 at 15:18
• Thanks, but is there a way for the caller to not pass an additional variable from the outside? – user3075898 May 29 '17 at 15:39
• I've outlined 4 ways in the linked topic. But passing them explicitly seems to be a standard – Kuba May 29 '17 at 15:44