Linked Questions

51 votes
1 answer

Local variables in Module leak into the Global context

From the Mathematica documentation on Module: Module allows you to set up local variables with names that are local to the module. But after using ...
owler's user avatar
  • 613
21 votes
3 answers

Variable scope similar to other languages

Mathematica, unlike many other languages, defines the variables in the global scope unless it is explicitly asked to define a variable in a local scope, e.g., using ...
Helium's user avatar
  • 4,049
23 votes
1 answer

What is the proper method to load a Mathematica package inside a DynamicModule

I have a DynamicModule that requires loading of Mathematica packages. The usual methods do not seem to apply (...
Nothingtoseehere's user avatar
7 votes
3 answers

Scope within Context

To define some package-wide functions/variables, what approach is recommended? I tried to use contexts with the Begin function, but this failed: ...
Karsten W.'s user avatar
  • 1,363
8 votes
3 answers

How to eliminate the need to double evaluate a Manipulate so that a Module in its Initialization section works?

Using V 8.04 on windows. I think this issue might be related to the fact that Mathematica reads main body the Manipulate before evaluating or running the Initialization option. Or, might be ...
Nasser's user avatar
  • 135k
10 votes
3 answers

Functions that creates symbol in a specific context

I'm trying to make a function f that takes a symbol, a value, and a context, and creates the symbol in the requested context and assigns it the passed value. The ...
Mohammed AlQuraishi's user avatar
3 votes
1 answer

Call Functions From File Without Modifying Context (Sandbox)

Let's say I have file named test.m containing test[arg1_] := ( Print[arg1];) What is the best technique for calling test like ...
William's user avatar
  • 7,565
8 votes
1 answer

Organizing similar datasets using Contexts or otherwise

I often import several long time series to analyze something about a city. When I have multiple cities, I use contexts. As a simple example, ...
ArgentoSapiens's user avatar
1 vote
2 answers

`Slot` (#) interfering with evaluation

In the following I am using one function makeFunc to assemble two functions a[t] and b[t] to ...
Andy Mobley's user avatar
6 votes
1 answer

Context Manipulation within Scoping Constructs

In the following the full context form of Test is not required as "Aaa`" is added to ...
Ronald Monson's user avatar
1 vote
0 answers

Begin[] again (V12.1)

Some questions related to $Context and $ContextPath have already been asked and answered, but I still cannot fully grasp the ...
Florian Hamamelis's user avatar