What is the other Mac?
But using a 2015 iMac for hat it sounds like will not work...
The following older iMac models can be used as an external display when plugged into another older Mac model.
iMac models introduced in 2011, 2012, 2013, and mid 2014
To use any of these iMac models as an external display:
- The iMac used as a display must have macOS High Sierra or earlier installed.
- The other Mac that you're connecting it to must have been introduced in 2019 or earlier and have macOS Catalina or earlier installed.
- The cable connecting the two Mac computers must be a Thunderbolt
or Thunderbolt 2
cable.
24-inch and 27-inch iMac models introduced in 2009 and 2010
To use any of these iMac models as an external display:
- The iMac used as a display must have macOS High Sierra or earlier installed.
- The other Mac that you're connecting it to must have been introduced in 2019 or earlier and have macOS Catalina or earlier installed.
- The cable connecting the two Mac computers must be a Mini DisplayPort
cable.