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

Return to Revisions

1 of 3
kirelagin
  • 13.7k
  • 2
  • 45
  • 59

Normally when you are developing a single application your directory structure will be similar to

src/
 |-myapp/
 |-pkg_a/
 |-__init__.py
 |-foo.py
 |-pkg_b/
 |-__init__.py
 |-bar.py
 |-myapp.py

This lets your whole project be reused as a package by others. In myapp.py you will typically have a short main function.

You can import other modules of your application easily. For example, in bar.py you might have

import myapp.pkg_a.foo

Actually, it's the only "good" way of organising your imports.

Of course, if one of your modules needs a module from another application it's a completely different story, since this application is an external dependency and you'll have to handle it.

kirelagin
  • 13.7k
  • 2
  • 45
  • 59

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