My attempt is to use the same function behind the above dialog in which QGIS allow to load project form a geopackage by giving the connection, the path. The idea is to be able to check if a geopackage contains project or not. what I did so far is the following
prj = QgsProject.instance()
prj.read('geopackage:/home/me/Downloads/test.gpkg')
but this gave me an error: ogr error no more rows
Thanks