I am working on synchronising the view extents of maps on layouts. I can do this using .layoutByName, .itemById, .extent and then .setExtent to get the Map I want from the right layout then find its extents and apply those to another map on a different layout. Currently I am getting the items using .layoutByName but as my layout names are going to change that won't work. I think I should be able to get the layouts by their Uuid but I can't figure out how. Currently my Code is something like the code below
Surveylayout_name = '24888-TRS-02' !!!This name will change!!
SurveyMap_name = 'Tree_Survey_Map'
#getting the layout details for the source plan
manager = QgsProject.instance().layoutManager()
sourcelayout = manager.layoutByName('24888-CON-01')
get_sourceMap = sourcelayout.itemById('Constraints_A')
get_sourcemap_extents = get_get_sourceMap.extent()
#getting the target plan
Target_layout = manager.layoutByName('24888-TRS-02')
get_TargetMap = Target_layout.itemById('Tree_Survey_Map')
get_TargetMap.setExtent(get_sourcemap_extents)