Greetings,
Better style in functional programming is to be as stateless as possible. Reverting to using global state, your life would be easier coding in Python. Isn’t this a classic use for a Reader monad, which is for the purpose of passing an environment around without having to do so explicitly?
Andrew