.. _python_api_change_account:

.. currentmodule:: flow360

**************************
Change Account and Submit
**************************

This example demonstrates how to utilize the shared account feature within the Flow360 Python API.
It covers the process of interactively selecting a shared account, submitting a pre-existing volume mesh
to initiate a project under that account, and subsequently reverting to the original account context.

.. code-block:: python

    import flow360 as fl
    from flow360.examples import OM6wing

    # choose shared account interactively
    fl.Accounts.choose_shared_account()

    # retrieve mesh files
    OM6wing.get_files()

    # submit mesh
    project = fl.Project.from_volume_mesh(
        OM6wing.mesh_filename,
        name="Account change mesh upload from Python",
    )

    # leave the account
    fl.Accounts.leave_shared_account()

Notes
=====

- ``Accounts.leave_shared_account()`` is used to exit the shared account context and return to the user's primary account.
