Get the notetype of the current selected card

I’m adding a button that will need the string of the notetype of the current card, e.g. “French Vocabulary.” Does anyone know how to do this?

If you have a Card object, you can use card.note().note_type()['name'] to get the notetype name.

E.g.

In the reviewer:

notetype_name = mw.reviewer.card.note().note_type()['name']

In the browser:

nid = browser.selected_notes()[0]
note = mw.col.get_note(nid)
notetype_name = note.note_type()['name']

In the editor:

notetype_name  = editor.note.note_type()['name']
2 Likes

That worked beautifully. Thank you!