python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.29k stars 582 forks source link

Cannot read properties of undefined (reading 'send') #650

Open ZeralldMC opened 1 year ago

ZeralldMC commented 1 year ago

Problem "Uncaught TypeError: Cannot read properties of undefined (reading 'send')" when i trying run a function with "eel.nice()" inside.

app.py

@eel.expose
def nice():
    print("GG")

topnav.html

        checkBox = document.getElementById('flexSwitchCheckDefault').addEventListener('click', event => {
            if(event.target.checked) {
                eel.nice()
                document.getElementById("languageSelect").setAttribute("disabled", '');
            }
            else {
                eel.nice()
                document.getElementById("languageSelect").removeAttribute("disabled");
            }
        });

This problem only appears if you put another code file using jquery. Is there an option when importing another html file to fix the problem or will EEL only work directly? Script in index.html:

 $(function(){
      $("#includedContent").load("topnav.html"); 
    });

image

Desktop