The lower sensor had broken away from its plastic mounting piece. I loosened the screw holding the mounting piece and the mounting piece dropped into the depths of the B pillar. Wasted an hour with a torch trying to see it. Using the upper sensor as a guide to its size I cut a piece of plastic with a slot for the screw, hoping to glue the sensor onto it. I wanted to try the plastic for size, and whilst screwing it into position I dropped the plastic and the screw into the depths of the B pillar. After some language not to be used in decent company I wasted another half hour trying to find it.
I then jacked the car up, took the wheel off and poked through the sunroof drain but nothing came out. More time wasted. I then glued the sensor against the bodywork in its approximate position, but the roof still did not work. More bad language. I called it a day.
I thought I may be able to find the sensor mounting pieces and screw if I could lift the roof from its mountings. Watched youtube videos on roof removal and decided to have a go the following day. I removed the 7 bolts from the U-piece and the 4 bolts from the hinges. I unclipped the frame from the 2 clips and thought that it was going well. Not for long. I could only lift the roof a couple of inches on the passenger side. It felt like something was stopping it. The driver's side came right out without a problem. Back indoors to check the workshop manual which said to move the roof motor towards the centre of the car if the roof would not come out. Tried that. The motor would not move.
My last desperate action was to cut a square of plastic of the correct thickness, glue it onto the bodywork and glue the sensor to the plastic.
I put everything back together and pressed the switch.It worked! It was 2 full days' work to get to this stage. I am hoping now that the sensor does not move.
The photos were very helpful.