Python from question

Asked 2 years ago, Updated 2 years ago, 16 views

I'm trying to import another package from For example,

When I'm like this, If you want to import domain.py from quiz.py

from context.domain import data

I know this is how you do it, but I don't know if you'll find a problem if I just tell you which one I'm missing When I do from context, the context does not appear as a keyword

python

2022-09-20 11:02

1 Answers

Although it belongs to the same dir, it is in different subdirectories, so you need to move the path.

dir
│
├ ├ a ━ aa.py
└ └ b ━ bb.py
# bb.py
from ..a.aa.py import aaa


2022-09-20 11:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.