I am working on writing a package for others to use. Using many of the functions requires a Config object, this is an example of how it would look right now for a user to use one of the modules: from pkg.config import Config from pkg import example_module config = Config("config.yml") example_module.func1(config, "abc") example_module.func2(config, "xyz") example_module.func3(config, 123) Basically, the user has to create an instance of the Config class, and then pass that object every single time they call a function from example_module. I would really prefer that they don't have to do this. Once the config information is established they should be able to just use the functions without passing it explicitly every time. I could create a class in example_module that requires the Config object when creating an instance: from pkg.config import Config from pkg.example_module import ModuleClass config = Config("config.yml") module_inst = ModuleClass(config) module_inst.func1("abc") module_inst.func2("xyz") module_inst.func3(123) I would like to avoid this if possible, though. The only reason I would create a class is to deal with passing this config information, not because I feel that the functions actually make sense in a class. (There are going to be other modules that are at a "higher level" that will use the lower level modules and if the only way to access the functions from the lower level modules is via a class then I will just end up with objects nested inside other objects instead of just simply importing and calling functions from the module directly.) I found this that says that the "canonical way" of passing information between modules is to create a config module and then import this in every other module. I understand this as far as the example they show with a simple integer, but I don't understand how this would work when using a config object like I am. Even if I didn't use a config object, I don't know how the user would set the information in the config module before proceeding. Is there a good solution to this that doesn't involve wrapping all my module's functions in a class? Continue reading...