$ContextPath

$ContextPath

is a global variable that gives a list of contexts to search, before $Context, in trying to find a symbol that has been entered.

Details

  • Each context is specified by a string of the form "name`".
  • The elements of $ContextPath are tested in order to try to find a context containing a particular symbol.
  • $ContextPath is modified by BeginPackage and EndPackage.
  • $ContextPath is a rough analog for Wolfram Language symbols of the "search path" for files in many operating systems.

Examples

open all close all

Basic Examples  (2)

The default contexts for looking up symbols:

In[1]:=
Click for copyable input
Out[1]=

The symbol Integrate can be found because it is in the "System`" context:

In[2]:=
Click for copyable input
Out[2]=

If a symbol with a given name is not found in one of the contexts in $ContextPath, it will be created:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

It is created in the context given by $Context:

In[3]:=
Click for copyable input
Out[3]=

Turn off the message for new symbol creation:

In[4]:=
Click for copyable input

Scope  (2)

Applications  (1)

Properties & Relations  (5)

Introduced in 1988
(1.0)
|
Updated in 2007
(6.0)