We make all our calls to bind_external() after the browser windows are already created. It's possible that JS in our windows could start running before the external object that it depends on is bound. Not sure if this ever happens.
This highlights a deeper issue, though, which is that external.py and browser.py are really poorly organized as separate modules. They depend on each other, and we end up with awful circularity issues like the one in main.py, where the application module has to be imported first or things break. Organizing things properly will probably fix this race condition too.
We make all our calls to
bind_external()
after the browser windows are already created. It's possible that JS in our windows could start running before the external object that it depends on is bound. Not sure if this ever happens.This highlights a deeper issue, though, which is that external.py and browser.py are really poorly organized as separate modules. They depend on each other, and we end up with awful circularity issues like the one in main.py, where the application module has to be imported first or things break. Organizing things properly will probably fix this race condition too.