Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

order consistency
Source Link
akinuri
  • 12.3k
  • 10
  • 75
  • 108

You should read this.

By putting the files at the same level, you put them is the same package level. In your case, you need to get this architecture:

mypackage
├── __init__.py
├── one.py # contains "import two"
└── two
 ├── __init__.py
 ├── two.py # contains "import three"
 └── three
   ├── __init__.py
   └── three.py
 └── two.py # contains "import three"

And then, you can access the package with:

import mypackage.one
import mypackage.one.two
import mypackage.one.two.three

You should read this.

By putting the files at the same level, you put them is the same package level. In your case, you need to get this architecture:

mypackage
├── __init__.py
├── one.py # contains "import two"
└── two
 ├── __init__.py
 ├── three
   ├── __init__.py
   └── three.py
 └── two.py # contains "import three"

And then, you can access the package with:

import mypackage.one
import mypackage.one.two
import mypackage.one.two.three

You should read this.

By putting the files at the same level, you put them is the same package level. In your case, you need to get this architecture:

mypackage
├── __init__.py
├── one.py # contains "import two"
└── two
 ├── __init__.py
 ├── two.py # contains "import three"
 └── three
  ├── __init__.py
  └── three.py

And then, you can access the package with:

import mypackage.one
import mypackage.one.two
import mypackage.one.two.three
added 4 characters in body
Source Link
aluriak
  • 6k
  • 2
  • 30
  • 43

You should read this.

By putputting the files at the same level, you put them is the same package level. In your case, you need to get this architecture:

mypackage
├── __init__.py
├── one.py # contains "import two"
└── two
 ├── __init__.py
 ├── three
 │  ├── __init__.py
 │  └── three.py
 └── two.py # contains "import three"

And then, you can access the package with:

import mypackage.one
import mypackage.one.two
import mypackage.one.two.three

You should read this.

By put the files at the same level, you put them is the same package level. In your case, you need to get this architecture:

mypackage
├── __init__.py
├── one.py # contains "import two"
└── two
 ├── __init__.py
 ├── three
 │  ├── __init__.py
 │  └── three.py
 └── two.py # contains "import three"

And then, you can access the package with:

import mypackage.one
import mypackage.one.two
import mypackage.one.two.three

You should read this.

By putting the files at the same level, you put them is the same package level. In your case, you need to get this architecture:

mypackage
├── __init__.py
├── one.py # contains "import two"
└── two
 ├── __init__.py
 ├── three
 │  ├── __init__.py
 │  └── three.py
 └── two.py # contains "import three"

And then, you can access the package with:

import mypackage.one
import mypackage.one.two
import mypackage.one.two.three
Source Link
aluriak
  • 6k
  • 2
  • 30
  • 43

You should read this.

By put the files at the same level, you put them is the same package level. In your case, you need to get this architecture:

mypackage
├── __init__.py
├── one.py # contains "import two"
└── two
 ├── __init__.py
 ├── three
 │  ├── __init__.py
 │  └── three.py
 └── two.py # contains "import three"

And then, you can access the package with:

import mypackage.one
import mypackage.one.two
import mypackage.one.two.three
lang-py

AltStyle によって変換されたページ (->オリジナル) /