Tag all selected elements in a view plan

Hi ,there

Can somebody help me with this:

I need to tag all selected elements in all views where the element is visible.
I have tried this, but it gives an error :

import clr
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB import BuiltInCategory
from Autodesk.Revit.DB import TagOrientation
from Autodesk.Revit.DB import TagMode
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

# Get current Revit document
doc = DocumentManager.Instance.CurrentDBDocument

# Get element to tag
selectedElements= UnwrapElement(IN[0])
views = IN[1]


t = Transaction(doc, 'Create Tag')
t.Start()
#

for v in views:
    for e in selectedElements:
        if True:
        #if e.IsHidden(v):
            
            p = e.Location.Point
            xyz = XYZ(p.X,p.Y,p.Z)
            
// Error in this function,
            tag = IndependentTag.Create(doc, ElementId(v.Id), Reference(e),False,TagMode.TM_ADDBY_MULTICATEGORY,TagOrientation.Horizontal,xyz)
    
            #tag.ChangeTypeId(multicategory.Id)
            tag.TagOrientation = TagOrientation.Horizontal

t.Commit()

It says I cannot use the id of a FloorPlanView as a parameter and instead needs an id of a View.
Does anyone know how can i converter FloorPlanView to view, or does anyone have another solution for this problem?

v.id should be giving the view id. You shouldn’t have to cast it as an ElementId.