I have an ArcGIS Pro project which contains multiple layouts. I've got a Python toolbox with a script which, among other things, chooses which of the layouts is appropriate for a specific map. At the end of the script, I would like the selected layout to open (if it isn't already), and have ArcGIS Pro move the 'focus' to the chosen layout. (i.e. if the layout is open but in a tab which is not in the front, I would like it to move to the front. 'Focus' might not be the right word to describe this.) I've looked through the ArcGIS Project object, and the layout object, without finding anything which will do this.


1 Answer 1


This is not possible with arcpy.mp. You will need to use the ArcGIS Pro SDK (.NET).

The snippets on this page should give you a starting point (relevant excerpts quoted below)

Activate an already open layout view

//Activate an already open layout view.
//A layout view may be open but it may not be active.

//Find the pane that references the layout and activate it. 
//Note - there can be multiple panes referencing the same layout.
foreach (var pane in ProApp.Panes)
  var layoutPane = pane as ILayoutPane;
  if (layoutPane == null)  //if not a layout view, continue to the next pane
  if (layoutPane.LayoutView.Layout == layout) //if there is a match, activate the view
    (layoutPane as Pane).Activate();

Open a layout project item in a new view

//Open a layout project item in a new view.
//A layout project item may exist but it may not be open in a view. 

//Reference a layout project item by name
LayoutProjectItem someLytItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("MyLayout"));

//Get the layout associated with the layout project item
Layout layout = await QueuedTask.Run(() => someLytItem.GetLayout());  //Worker thread

//Create the new pane
ILayoutPane iNewLayoutPane = await ProApp.Panes.CreateLayoutPaneAsync(layout); //GUI thread

Since you already have your Python tool set up, you could just make a tool in .NET that calls this Python tool, and then when finished uses the .NET code to do what you need to the layouts.

  • Thank you; I feared this might be the case. May 17, 2019 at 9:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.