Comment

Rather than passing it to every function, you can make a global "context server" that any function that needs the context can access. You could make a module that handles this (which will automatically be global) and have methods on it. For multi-threaded access, the module can handle locking if you need that, so clients can block while you're making changes to the context. (Does this make sense, or am I missing something?)

The point is that if something needs to be passed to *many* different functions, objects, or methods, it's probably an aspect of the *system* that everyone should have easy access to, not something that should be shuffled along the call stack.