What about singletons?
Singletons
are global variables. They share a lot of their problems, it's just that some people consider singletons a good solution because they are object-oriented. Their original intention was to ensure single instances, however they are often overused and abused as "better" global variables.
The best option is to keep dependencies as local as possible, therefore you should normally prefer passing function arguments.