Python/JS server for soundtrack compatibility

So I have a text game I’ve been working on in python, and iframed to an html/js project to add easy website support. However, I’ve been wanting to add music for each different area in the game, and obviously I can’t have the html project detect python variables - is there any way I would be able to set up a server of sorts to transmit information from the python project that the html/js could pick up and know what music to play?

1 Like

The easiest way to run a webserver in Python is with the Flask library. Your webserver would listen to incoming requests and send back responses accordingly.

If you’d like us to assist with the implementation, you will need to provide more details about how you’re iframing your application and how you manage game state. I hope this helps!

1 Like

Sorry for the extremely late reply, kinda forgot about this. Details: I have a python project, (https://replit.com/@AquiIo/The-Lands-of-Iloraea-v11?v=1) , and then a completely separate html/js project that just runs an iframe of the python cover page. I’m not sure how flask would work in this situation, because the files aren’t in the same project, and was wondering if there was a way to create a server the python project sends info to and the js picks up while being iframed, if that makes sense.

1 Like