'Collection' object has no attribute 'add_notes'

Hi all,

I’m getting a strange behaviour when trying to call the add_notes method of the Collection object. Specifically, it suggests that the method doesn’t exist.

To debug, I ran the following code snippet:

methods = [str(method) for method in dir(my_object) if callable(getattr(my_object, method))]

This verifies that, indeed, the add_notes method is not there (only add_note).

Inspecting the source code for the ‘Collection’ object suggests that this method is present. I’ve tried upgrading Anki to the latest version, in case the version used in the app is was old and out-of-date, but this doesn’t solve the issue.

Does anyone have any insight on why this might be happening? Alternatively, a workaround for correctly returning an OpChanges object after repeatedly calling the add_note method would be much appreciated!

Thanks in advance.

.add_notes() was added in 23.10. I can’t think of a reason why it might not work other than if you’re using an older version.

Here’s a workaround that involves merging undo entries: smoothbrain-anki/__init__.py at f22eb5e2cc8ed97cab7f45a3bddbddcd22230e23 · smoothbrain-ai/smoothbrain-anki · GitHub

1 Like

That’s useful, much appreciated! Yes, I have no idea why it’s not listed despite upgrading. Will look into using that workaround for now, thank you for your help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.