0

I have a file structure that looks like this:

  • pckg/
    • __ init __.py
    • module1
    • module2
    • module3
    • module4

In the __init__.py I import all of the classes from the modules, so they are available on 'from pckg import (class)' However, I can't seem to use this method within the modules.

For example, in module1 I have to import the classes I need from module2 and module 3, I can't directly import them from pckg. Is this the expected result when trying to import from within a package, or am I doing something wrong? Let me know if more info would be helpful.

Iguananaut
  • 21,810
  • 5
  • 50
  • 63
lnhubbell
  • 3,304
  • 5
  • 17
  • 22
  • possible duplicate of [Circular (or cyclic) imports in Python](http://stackoverflow.com/questions/744373/circular-or-cyclic-imports-in-python) – Iguananaut Feb 19 '15 at 23:38
  • You might want to have a look at the discussion in http://stackoverflow.com/questions/744373/circular-or-cyclic-imports-in-python – Iguananaut Feb 19 '15 at 23:38

1 Answers1

0

This is the expected result, because I am doing a circular import without realizing it!

Thanks to a comment from Iguananaut I realized this is an example/special case of the Circular imports in Python, which is addressed elsewhere.

lnhubbell
  • 3,304
  • 5
  • 17
  • 22