Bluetooth on my iMac keeps shutting off

I have a 2011 iMac,2.7 GHz Intel Core i5 with 16 RAM. Ever since the latest OS upload, my Bluetooth shuts off randomly. When I go to systems preferences/Bluetooth, the option to turn Bluetooth on is greyed out. The only way I can turn it back on is to restart. The batteries in my keyboard and my magic mouse are new. Please help, for this is very upsetting. Thank you.
I have the same year and model but don't use it daily. I have seen times when tapping the space bar didn't wake it. I'll keep notice and see if nine does it. And it's the latest OS?
yes, latest OS. It's very erratic, sometimes I have connectivity for a half hour, sometimes ten minutes.
You might have some interference causing problems. Apple has some words about sources of interference. Or, perhaps, the 7-year-old computer is having a hardware failure. Apple has a Hardware Test you can run.

Finally, even though it is a pain, you could try reinstalling macOS.

Original thread: https://forums.imore.com/threads/bluetooth-on-my-imac-keeps-shutting-off.400078/