# How to obtain party identifiers in the \`dazl-client\` python library in 2.x.x?

**URL:** <https://forum.canton.network/t/how-to-obtain-party-identifiers-in-the-dazl-client-python-library-in-2-x-x/4390>\
**Category:** App Development\
**Created:** [April 20, 2022, 7:39pm UTC](https://forum.canton.network/t/how-to-obtain-party-identifiers-in-the-dazl-client-python-library-in-2-x-x/4390 "2022-04-20T19:39:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mesch](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mesch/32/3248_2.png) [@mesch](https://forum.canton.network/u/mesch)\
**Post date:** [April 20, 2022, 7:39pm UTC](https://forum.canton.network/t/how-to-obtain-party-identifiers-in-the-dazl-client-python-library-in-2-x-x/4390/1 "2022-04-20T19:39:32Z")

</div>

In 1.x, we could just the display names supplied when the Parties are allocated in API that calls that need Party IDs. In 2.x this is no longer possible, because the display names are no longer used as the party IDs.

Now, how do I obtain the actual Party IDs to be used in API calls. Specifically, how do I make the `act_as` argument in the `connect` call in the `dazl` API work:

```haskell
    async with dazl.connect(url=FLAGS.ledger_backend,
                            act_as=[dazl.Party('A'), dazl.Party('B')]) as conn:
        await asyncio.gather(A(conn), B(conn))

```

`A` and `B` are the Party names used in `daml.yaml`. They used to work in 1.x, but in 2.x this yields an `INVALID_PARTY_IDENTIFIER` error message.

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [April 20, 2022, 7:44pm UTC](https://forum.canton.network/t/how-to-obtain-party-identifiers-in-the-dazl-client-python-library-in-2-x-x/4390/2 "2022-04-20T19:44:59Z")

</div>

I recommend reading through [our blogpost on parties & users in daml 2.0](https://blog.digitalasset.com/developers/parties-users-daml-2).

To answer your concrete question you first have to allocate your parties (e.g. via daml script’s `allocateParty`) and then use the result of that as your party id in dazl. One approach could be that your daml script writes out the party ids it has allocated to a json file via `--output-file` and you read that file in your python code.

---

<div class="post-metadata">

**Author:** ![mesch](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mesch/32/3248_2.png) [@mesch](https://forum.canton.network/u/mesch)\
**Post date:** [April 20, 2022, 9:03pm UTC](https://forum.canton.network/t/how-to-obtain-party-identifiers-in-the-dazl-client-python-library-in-2-x-x/4390/3 "2022-04-20T21:03:19Z")

</div>

Thank you for the pointer, reading now.

I already found the hint to create a Daml script to initialize the parties, and to include it in `daml.yaml`. So I already have this:

```haskell
init-script: Setup:initializeUser

```

Is there a way to obtain the output of the `init-script` specified in the `daml.yaml` file?

---

<div class="post-metadata">

**Author:** ![mesch](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mesch/32/3248_2.png) [@mesch](https://forum.canton.network/u/mesch)\
**Post date:** [April 21, 2022, 12:48pm UTC](https://forum.canton.network/t/how-to-obtain-party-identifiers-in-the-dazl-client-python-library-in-2-x-x/4390/4 "2022-04-21T12:48:17Z")

</div>

> Is there a way to obtain the output of the `init-script` specified in the `daml.yaml` file?

OK, I found

```haskell
daml start --script-option=--output-file="..."

```

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [April 21, 2022, 12:56pm UTC](https://forum.canton.network/t/how-to-obtain-party-identifiers-in-the-dazl-client-python-library-in-2-x-x/4390/5 "2022-04-21T12:56:06Z")

</div>

There is also a `script-options` section where you can specify this in your `daml.yaml`.

---

<div class="post-metadata">

**Author:** ![mesch](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mesch/32/3248_2.png) [@mesch](https://forum.canton.network/u/mesch)\
**Post date:** [April 21, 2022, 4:09pm UTC](https://forum.canton.network/t/how-to-obtain-party-identifiers-in-the-dazl-client-python-library-in-2-x-x/4390/6 "2022-04-21T16:09:22Z")

</div>

Thanks a lot. It works for me now. I marked the solutions above.

Cheers,  
mesch.
