Hi i need help getting a python syntax right. I am trying to get all the objects in my scene with property[“books”] in my scene and add them together. This is what I got
objects_with_books = [s for s in scene.objects if ‘books’ in s]
which returns a list. Id like to add them togehter to get a total amount of books. I know how to ad them together if I know how many objects are on scene.
total_books = objects_with_books[0][“books”] + objects_with_books[1][“books”] etc.
My problem is that there are not always and always the same amount of objects with books in the scene. I dont know how to make the python code to iterate by itself and get the total of books regardless of how many objects with books are on the screen. Any help is appreciated.