hi @SaadKhan
I think the background_callback would be a good option here. Feel free to read the intro post to the background callback. Toward the end of that section, you’ll see a gif of a button deactivating while calculations are running.
You can also find a working example code in our docs.