If the library is housed on an iMac, of course it is not going to be there if the Mac is sleeping or closed down. The Mac needs to be running and awake for the library to be available.
Should have said when I open the iMac up again and try to play music
Technically, you are streaming, from the Mac to the Sonos. Or even more technically, vice versa. The thing to remember is you’re telling the computer on each Sonos device where to reach out and ‘get’ the music data. So, as @jgatie suggests, the source needs to be available for Sonos to ‘get’ the data.
I’m a little confused about some of your statement, about keeping areas separately. Is the Sonos being given access to both areas simultaneously?
Sonos (the computers on the devices) use SMB to reach out across the network to get the music data. That should always be ‘available’ to Sonos, but it doesn’t make any sense to me that after rebooting your Mac, it loses connection, and has to be reset up. Unless there are some settings on your Mac (or firewalls or other port blocking process) that turns off SMB access. Which I can’t think of on my Mac’s OS.
Have you submitted a system diagnostic within 10 minutes of experiencing this problem, and called Sonos Support to discuss it? Don’t post the resulting diagnostic number here, they get sensitive about GDPR.
There may be information included in the diagnostic that will help Sonos pinpoint the issue and help you find a solution.
So I connected Sonos support, submitted diagnostic there is some improvment but still not always finding library seems then to need library re-indexing (suggested by Support) to get it working again a hassle but managable.