Py2neo script has stopped, but query continues

I used py2neo to make a query, but the query is complex, so I stopped the py2neo script early, but the query continues in neo4j server. So how to set when the py2neo script stops, The query in the neo4j server also stops? Or can the official neo4j python library meet my needs? What shall I do?
thank you!

Manage queries - Operations Manual might be what you're looking for. There are queries to list and kill running transactions.

Thank you very much. I will do a test.

Also, be aware that the last version of py2neo was from 2021 so might be worth looking at using the official neo4j python driver for future