# Removing commands used before loading package

Original Question: I used the convert command before loading the Units package.

Convert[20000. Feet, Mile]


Since Convert isn't defined, it returns unevaluated. Now if I load the units package, the function evaluates, but the symbols Convert, Feet, and Mile are highlighted in red by the front-end:

Needs["Units"]
(* Convert::shdw: Symbol Convert appears in multiple contexts {Units,Global}; definitions in context Units may shadow or be shadowed by other definitions. >> *)

Convert[20000. Feet, Mile]
(* 3.78788 Mile *)


I know I could restart the kernel and load the package, but how else can I proceed at this point to get rid of the shadowed definitions and make everything work properly?

I tried Remove[Convert,Mile,Feet], but then Convert no longer works (expected), then I tried reloading the package, but the command still doesn't work.

Fix for my problem: According to the helpful comments and the answer by @Szabolcs, it seems my mistake was not paying attention to the context of the symbols that were shadowed. The following code shows one way to solve the issue I encountered:

## 1 Answer

You need to use

Remove[GlobalConvert]


instead of

Remove[Convert]


Convert is coloured red as a warning because both UnitsConvert and GlobalConvert exist, so when you simply type Convert one of the two has to be chosen, which might not be the one you wanted.

• @Szaboics: That did not seem to work, see my posting at the end of my question. Nov 27, 2014 at 21:47
• @David Actually it does work. I try not to post answers without testing them. What likely happened in your case was that first you Removed UnitsConvert (Remove[Convert] does that), and then you removed GlobalConvert as well. Then you tried re-loading the package using Needs, which did not have any effect as the package was already loaded. Needs differs from Get precisely in that it doesn't read packages that are already loaded. Nov 27, 2014 at 22:06
• Does is make sense to include the differences between Get and Needs in your answer as well? It seems as if they go nicely together with your comments on Remove, making a more canonical answer. Nov 27, 2014 at 22:39
• @Szaboics: Your last comment was correct and you can view the results above in my original question under the heading Second Attempt at Fixing the Problem. Thanks for your effort. I've learned a lot. Nov 27, 2014 at 23:35
• @David If you accidentally remove UnitsConvert, you can re-load the package using <<Units . This only differs from Needs["Units"] in that it doesn't have a re-load protection. Nov 28, 2014 at 0:01