How to pause a print to insert something in a cavity using Ultimaker Cura?
Ultimaker Cura contains "Extensions"; in version 4.1.0, the process is as follows:


Extensions -> Post Processing -> Modify G-code
Add a Script -> Pause at height


Choose the one that matches your firmware!

Choose the Pause height to match the height the insertion should take place. Usually, this is to be the layer just before the roof is to be printed to keep the inserted objects from protruding from their cavities.
Choose a park position well outside of the print. X 10 Y 10 is usually a good position for this.
Add a little retraction if you want.


In printing, you have to wait till the cavity is formed, insert the item quickly and press the control button to resume. The shorter the pause, the better the next layer will hold to the already printed.

Also, keep in mind to make the cavity a little larger than the insert, both in XY and Z, to compensate for the plastic shrinking a little and to allow the nozzle to pass well over the inserted item.