Most of options of the panel serve CLI command have their equivalents as parameters in pn.serve method. It is not always one-to-one mapping, as in the case of --index.
However, I have not found how to call pn.serve with equivalents of the following panel serve options:
--reuse-sessions: Whether to reuse sessions when serving the initial request.--global-loading-spinner: Whether to add a global loading spinner to the application(s).