Ask the first unit if they can arrange a clearance for you through the second piece of airspace.
If they say "Yes", then it's all done for you. If they say you'll need to contact them yourself, then ask if you can leave the first frequency and contact the next one in plenty of time.
There is no problem leaving the frequency of the first one to go to the second one, while you're still inside the first one, so long as they authorise that. In fact in the past, I've had occasion where I've got a clearance to enter the first one, and allowed to call the second one before actually entering the first one! Small airspaces sometimes require that.