I found the answer while researching another answer.
It's actually an attribute of File context which unless I'm mistaken does require the piece of code to be executed inside the context of the asset browser.
Here's the slightly altered script that adds a button in the Asset Browser header that, when clicked, outputs some information about the selected assets in the console :
import bpy from pathlib import Path class PrintSelectedAssets(bpy.types.Operator): bl_idname = "asset.print_selected_assets" bl_label = "Print Selected Assets" @classmethod def poll(cls, context): return context.selected_asset_files def execute(self, context): current_library_name = context.area.spaces.active.params.asset_library_ref if current_library_name != "LOCAL": # NOT Current file library_path = Path(context.preferences.filepaths.asset_libraries.get(current_library_name).path) for asset_file in context.selected_asset_files: if current_library_name == "LOCAL": print(f"{asset_file.local_id.name} is selected in the asset browser. (Local File)") else: asset_fullpath = library_path / asset_file.relative_path print(f"{asset_fullpath} is selected in the asset browser.") print(f"It is located in a user library named '{current_library_name}'") return {"FINISHED"} def display_button(self, context): self.layout.operator(PrintSelectedAssets.bl_idname) def register(): bpy.utils.register_class(PrintSelectedAssets) bpy.types.ASSETBROWSER_MT_editor_menus.append(display_button) def unregister(): bpy.types.ASSETBROWSER_MT_editor_menus.remove(display_button) bpy.utils.unregister_class(PrintSelectedAssets) if __name__ == "__main__": register()