Is there a way to manually exit a trio infinite loop, like the echo client in the trio tutorial, https://trio.readthedocs.io/en/latest/tutorial.html#an-echo-client , other than using Ctrl-C or using timeouts?
My idea is to use call the echo client from another python script, and be able to close it arbitrarily. I was thinking of using a flag (maybe event?) as a switch to trigger the cancel_scope.cancel() in the nursery. But I am not sure how to do it. Greatly appreciate any help, Thanks.