Please Help me optimise my app(uses p5 python port)

https://github.com/1999shaswat/a-star
Source Code in sketch.py
My python program (shortest path using a star), worked fine in previous releases of p5py. (As shown in gif in github page [ignore lag, peek gif recorder problem])
But after updating python(3.7.x -> 3.8.3) and p5py(0.6 ->0.7.1), app first started crashing. Then found error in line 37(that never existed before). After fixing that, the app runs WAY SLOWER than before. Please help. Thank you :3