Database Stuck in "Restoring" in SSMS After Running From an Outside Process
The problem is that you need to give it time so the database restores.

When you run your python code to execute the stored procedure, don't close the connection instantly, but pop a time.sleep(10) after it. This will give the database some time to prepare it to the online state (the time you need to sleep will vary based on db size).