Found the answer to my own question in old posts here. (Thank you Matteo!)
I have added this code to the processAlgorithm() function:
```
context.addLayerToLoadOnCompletion(
f'{gpkg_fn}|layername=my_view',
context.LayerDetails(
name='my_view',
Hi developers,
I have created a processing algorithm in python that creates a new gpkg
database with a bunch of tables and views. One of the views can be
loaded as a polygon layer, which works fine when loaded manually.
How can I tell QGIS to load that view as a polygon layer when the
algori