Duplicated View, how to apply name?

My google powers are failing me today, I figured this would be a simple search.

In python, I have created and duplicated views as dependent for area plans. These Duplicated views return the view ID, how do I select this view by ID so I can name the view? I already have the ID singled out in the loop so as the loop iterates, all I want to do is name the view upon duplication.

I can’t find or figure out how to access views by ID, outside of a filtercollection

CreateViewPlan() is a function which creates my views
and
for i in lstFloorPlan:
for j in i:
for n in dupNum:
flattens my list of newly created views. just FYI

thanks for any assistance,

##  FLOOR PLAN SHEET VIEWS

x = selectedLevel.Name
y = x.split()
x = y.index("LEVEL") + 1
z = y[x]

lstFloorPlan = []
lst = []
dupNum = range(4)
for i in dictFloorPlanSheetViews.keys():
	val = dictFloorPlanSheetViews.get(i)
	viewName_FloorPlan = selectedLevel.Name + " - " + i
	newView_FloorPlan = CreateViewPlan("FloorPlan", selectedLevel, viewName_FloorPlan)
	lstFloorPlan.append(newView_FloorPlan)
	
for i in lstFloorPlan:
	for j in i:
		for n in dupNum:
			dupViewId = j.Duplicate(ViewDuplicateOption.AsDependent)
		


OUT = dupViewId

https://www.revitapidocs.com/2020/d9848d7d-5917-2433-8454-f65f5ac03964.htm

Thank you Nick,
I was dancing all around it but couldn’t figure it out. I have it working now… :slight_smile:
https://thebuildingcoder.typepad.com/blog/2012/04/getelement-method-and-get-element-type.html

##  FLOOR PLAN SHEET VIEWS

x = selectedLevel.Name
y = x.split()
x = y.index("LEVEL") + 1
z = y[x]

cnt = range(IN[1])
ltr = []
alpha = 'A'
alphaList = []
for i in range(0, 26):
    alphaList.append(alpha)
    alpha = chr(ord(alpha) + 1)
 
lstFloorPlan = []
for i in dictFloorPlanSheetViews.keys():
	val = dictFloorPlanSheetViews.get(i)
	viewName_FloorPlan = selectedLevel.Name + " - " + i
	newView_FloorPlan = CreateViewPlan("FloorPlan", selectedLevel, viewName_FloorPlan)
	lstFloorPlan.append(newView_FloorPlan[0])
	
	for j in cnt:
		ltr.append(alphaList[j])		
		dupViewId = newView_FloorPlan[0].Duplicate(ViewDuplicateOption.AsDependent)
		doc.GetElement(dupViewId).Name = selectedLevel.Name + alphaList[j] + " - " + i