HC05 Bluetooth Ping without losing connection
You need to ping it using the Python script. Using Python Ping is probably the easiest way. This tutorial shows you step by step how to set it up and use it. https://www.ictshore.com/python/python-ping-tutorial/

If you want to do it without that, read this stack overflow response.
https://stackoverflow.com/questions/2953462/pinging-servers-in-python