'List[Object]' has no attribute 'Id'

Not sure if you got your original question answered but the issue is that you’re trying to get the Id of a list.
List[object] has no attribute Id. You need to iterate through your list with something like:

for object in objectList:
     object.Id

hi,

how to define viewport?

As I mentioned: You need to put the method in parenthesis.