Skip to content

Instantly share code, notes, and snippets.

@TheBlusky
Created January 3, 2018 15:03
Show Gist options
  • Save TheBlusky/8e9e0795635ef4c2512926bd20115c12 to your computer and use it in GitHub Desktop.
Save TheBlusky/8e9e0795635ef4c2512926bd20115c12 to your computer and use it in GitHub Desktop.
ImportError: cannot import name A2
from .pack_a import A1, A2
from .pack_b import B1, B2
from .pack_b import B1
class A1:
def __init__(self):
print("A1")
B1()
class A2:
def __init__(self):
print("A2")
from .pack_a import A2
class B1:
def __init__(self):
print("B1")
class B2:
def __init__(self):
print("B2")
A2()
from pack import A1, A2, B1, B2
A1()
B2()
@TheBlusky
Copy link
Author

TheBlusky commented Jan 3, 2018

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from pack import A1, A2, B1, B2
  File "/home/Blusky-Desktop/python_test/pack/__init__.py", line 1, in <module>
    from .pack_a import A1, A2
  File "/home/Blusky-Desktop/python_test/pack/pack_a.py", line 1, in <module>
    from .pack_b import B1
  File "/home/Blusky-Desktop/python_test/pack/pack_b.py", line 1, in <module>
    from .pack_a import A2
ImportError: cannot import name A2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment