Small problem importing a file if there are multiple folders

Viewed 28

Let's say I have a folder called NewFolder1 with the NewFolder2 folder inside which contains python files, so Newfolder1/Newfolder2/file.py

To import the py file, can I write directly from NewFolder1 import *? (which includes all the contents of the first folder?)

Or in Python, if I have a folder in another folder, I have to specify from NewFolder1.NewFolder2 import file?

Do you always have to specify the full path or is a from NewFolder1 import * okay to access the file inside NewFolder2?

0 Answers
Related