Can you use a 2019 imac as an external monitor for a 2019 macbook pro
I have an iMac 2019 (3GHz, 6-core Intel core i5) running Big Sur and a Mac Book Pro 16 2019 (2.6 GHz, 6-core Intel core i7) also running Big Sur. I have connected the 2 with a thunderbolt cable (USB-C to USB-C). After looking online it seems that I need to hold down the command and F2 buttons on the iMac to make this an external monitor but it's not working.
Is this possible to do? Do I need a different cable?
Many Thanks for any help