# Import Error when trying to create one2Many

**URL:** https://discuss.tryton.org/t/import-error-when-trying-to-create-one2many/8065
**Category:** Developer
**Created:** [November 27, 2024, 12:53pm UTC](https://discuss.tryton.org/t/import-error-when-trying-to-create-one2many/8065 "2024-11-27T12:53:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Gruenfischer](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@Gruenfischer](https://discuss.tryton.org/u/Gruenfischer)
#### Post date: [November 27, 2024, 12:53pm UTC](https://discuss.tryton.org/t/import-error-when-trying-to-create-one2many/8065/1 "2024-11-27T12:53:32Z")

</div>

Hi,  
I followed basically the module tutorial from the docs with tryton 7.2.11, creating a module named “Groupfund”. Its located in the trytond/modules/ .. folder, but the same error appears when installed it with pep517 like it is recommended.

At the point, where I add the line  
`from . import party` to the **init**.py, I get the error  
`ImportError: cannot import name 'party' from partially initialized module 'trytond.modules.groupfund'`  
Goal is to create a one2Many field in “groupfund” towards party.

The error appears even without any code in “groupfund.py” referring to the party module. There is no other import of party, so I cannot see any hint towards an circular import.

Any hints how to get this solved, I tried a lot with import order etc. but was not succesfull at all.  
Regards Jakob

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [November 27, 2024, 1:03pm UTC](https://discuss.tryton.org/t/import-error-when-trying-to-create-one2many/8065/2 "2024-11-27T13:03:51Z")

</div>

Probably you have some code in your ` __init__.py` file which imports some module that does not exist. This cause the import system to break when loading the module and causes the error message you have.

Could you check your file if that is the problem?

---

<div class="post-metadata">

### Author: ![Gruenfischer](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@Gruenfischer](https://discuss.tryton.org/u/Gruenfischer)
#### Post date: [November 27, 2024, 1:06pm UTC](https://discuss.tryton.org/t/import-error-when-trying-to-create-one2many/8065/3 "2024-11-27T13:06:43Z")

</div>

```auto
from trytond.pool import Pool
from . import party
from . import groupfund

__all__ = ['register']

def register():
    Pool.register(
        groupfund.Group, 
        groupfund.Member,

        module='groupfund', type_='model')
    Pool.register(
        module='groupfund', type_='wizard')
    Pool.register(
        module='groupfund', type_='report')

```

Its basically the **init**.py from the tutorial. The moment i add the … party line, I get the error.

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [November 27, 2024, 2:16pm UTC](https://discuss.tryton.org/t/import-error-when-trying-to-create-one2many/8065/4 "2024-11-27T14:16:51Z")

</div>

Why do you import party in **init**.py ?

party should be a depends in your tryton.cfg

---

<div class="post-metadata">

### Author: ![Gruenfischer](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@Gruenfischer](https://discuss.tryton.org/u/Gruenfischer)
#### Post date: [November 27, 2024, 3:14pm UTC](https://discuss.tryton.org/t/import-error-when-trying-to-create-one2many/8065/5 "2024-11-27T15:14:17Z")

</div>

I knew it was a incredibly stupid problem… since I didn´t create a party.py in the project but included class Party() in the goupfund file.

Thank you

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [November 28, 2024, 3:14pm UTC](https://discuss.tryton.org/t/import-error-when-trying-to-create-one2many/8065/6 "2024-11-28T15:14:27Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
