Connect Twine to a python code

Before I begin - I am a newbie to coding and still learning, so please excuse my question if it is too basic.

Can I connect my python code that determines a condition, to then make a click on my twine story? For example - I am creating a chatbot to decide which choice will best move the story forward. My code successfully returns the choice the user wants to make, but I do not know how to take this choice from my python code and make it click/select the same on my twine story. Can anybody help? Thanks!

1 Like

It might be possible, but I don’t think it will be straightforward.

The simplest way I can think of is to set up a python server. You can do it with flask or bottle.

There might be some python library specific for your use case.

I would suggest, if possible, to do everything in the front end on the side of the twine game.