Loading a package may result in shadowed symbols. Here is what to do about it.

Define a symbol or function

Define the symbol A1:

New symbols are created in the Global` context by default:

Load a package

Load the Music package. That package defines the symbol A1 in the Music` context, which shadows the previously defined symbol Global`A1:

Now A1 refers to the symbol in the Music` context:

The value of A1 in the Music` context differs from the value in the Global` context. The red coloring indicates that the Global`A1 symbol is shadowed:

The previously defined value of A1 can be accessed by specifying its context explicitly:

  • Shadowing means that the same symbol occurs in more than one context on the context path, $ContextPath, making one or more symbols inaccessible unless you specify an explicit context. See the Contexts and Packages tech note for detailed information.

Resolve the shadowing

Remove the shadowed symbol to resolve the shadowing:

The A1 symbol is no longer colored red, indicating that it is no longer shadowing any other symbols:


Avoid shadowing by adhering to the convention that user-defined symbols and functions begin with lowercase letters.
Shadowing does not necessarily involve user-defined symbols. If two packages define the same symbol, loading both in the same session will result in shadowing. In that case, either of the symbols can be removed to resolve the shadowing.