import in code
Cameron Simpson
cs at cskk.id.au
Sun Jul 22 00:49:02 EDT 2018
On 22Jul2018 14:45, Cameron Simpson <cs at cskk.id.au> wrote:
>Circular imports: 2 codependent modules. If you have:
>
> module A:
> import B
>
> module B:
> import B
>
>That won't work: the second import (whichever it turns out to be) will
>fail. One workaround is to make one of the modules put off the
>import. A better approach is usually to redesign things so that they
>don't do a mutual import (move classses etc around, or merge them).
>This is always feasible, but often is.
That should be "This _isn't_ always feasible, but often is".
Sorry,
Cameron Simpson <cs at cskk.id.au>
More information about the Python-list
mailing list