So the thing I found out is that the footer had to be included for this to work, I suspect this is due to the page loading to fast and not picking up the script, or it may be due to the footer being mandatory I am not sure.
Adding this to any page that didn't have the footer solves the issue:
{% block footer %}
<div class="d-none">
{% include "footer.html" %}
</div>
{% endblock %}