Import Error when trying to create one2Many

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

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?

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.

Why do you import party in init.py ?

party should be a depends in your tryton.cfg

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

1 Like

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