Using Python, how to check if an object is linked from external blend file?

bpy.data.objects['my linked object'].library I found this code through a search and tried to check the linked object, but in 2.91, this code doesn’t seem to print anything.

Is there a new way to check if an object is linked from external blend file?

You sure its linked and not appended ?

After File->Link your object will contain a non-null value of library, but I noticed if you “Add Library Override” on it then the value will disappear. I think this is because another object appears that has this property, but it is not in the scene tree.