Using require for global modules is bad but what's the alternative?

I have a module that I use to interactively make changes to widgets in my notebook:

define(["jquery", "lib/jquery.awesome-cursor.min"], function($) {
    return {
        paintRed: function() {
            $('.chiSqValues').awesomeCursor('paint-brush', {
                color: 'red',
                hotspot: 'center'
            });
            $('.addEffectButton').addClass('redBorder')
        }
    }
});

I tried putting

display(Javascript('''
require(["models/chiSq"], function(chiSq) {
    chiSq.paintRed()
});
'''))

in the parts of my python code where I wanted the change to occur, only to discover that require is only called once. I have seen suggested here to create a global variable for the module.

require(['models/chiSq'], function(chiSq){
   window.chiSq = chiSq;
});

but as was noted in the comments, this is hacky and pollutes the global namespace.
Reguardless, I need to be able to call my module throughout my application based on certain events, and my module has important dependencies. What is the best practice for this kind of situation?

The answer to this question is to use custom widgets, that allow communication across python and jupyter. I originally looked at this page a long time ago, but didn’t have enough prerequisite knowledge for it to make sense. Upon seeking my own solution I accidentally learned what I needed to know to get started. It requires knowledge of general MVC design, RequireJS, and Backbone.js. Once you have a handle on that, custom widgets are a very neat solution with the communication details all taken care of!