I’m trying to write an HTML GUI for a project with cefpython. I’ve been able to create a working GUI in HTML, but I’d like to be able to expose python functions in javascript. There’s a tutorial on how to do this in the cefpython GitHub repo, but it involves writing your HTML in a string in the python program and converting it into a data URI. Is there a way to interface python and javascript while keeping your HTML in a separate file? Right now, I’ve passed cefpython the address of my HTML file as the URL to open, but I don’t necessarily need to use that method. I just want to have HTML in an external file and call a python function from javascript run on that page (so that I can call a python function by pressing a button on the page.)
Edit: My question is: how do I call a python function from javascript contained in an external HTML file, using the cefpython library?
from cefpython3 import cefpython as cef
import sys, os
sys.excepthook = cef.ExceptHook
cef.Initialize()
cef.CreateBrowserSync(url="file:///./main.html")
cef.MessageLoop()
cef.Shutdown()