[Python] Imports of self-written tools in Python [duplicate]

Discussão em 'Python' iniciado por Stack, Julho 8, 2025.

  1. Stack

    Stack Membro Participativo

    I read a few posts about it but I can't wrap my head around how to design a proper structure that doesn't need me to do some hacky stuff.

    My project folder at the moment is structured like this:

    Projektfolder
    ├──Part_1
    | ├── Calc_for_part_1.py
    | ├── Output,imports,other stuff i need for 1
    ├──Part_2
    | ├── Calc_for_part_2.py
    | ├── Output,imports,other stuff i need for 2
    ├──Tools
    | ├── self_written_helper_tool.py
    |


    I need the self_written_helper_tool in both Calc_for_part because there are some common calculations I don't want to have in 2 different places.

    But I don't get how I can properly import the helper_tool. From what I found this is not usually done or done by transforming the whole thing into a package (which I unsucessfully tried). Is package the way to go or is there a convenient way to do this?

    Continue reading...

Compartilhe esta Página