Home > front end >  Importing many python files from a seperate folder into a single other python file
Importing many python files from a seperate folder into a single other python file

Time:10-12

Files folder containing levels

enter image description here

the import lines

enter image description here

As shown in the second image, in order to import 'level_one', python wanted me to create its own import line, I tried to import both levels: level_one and level_two, by using the * symbol, which is what you would do to import all methods in a library (I believe this is how it works) But that doesn't work. The picture below shows me attempting to call out a dictionary I have written in the 'level_two.py' file, but I would need another import statement to make it work.

Where the file is called

enter image description here

Many thanks

CodePudding user response:

It appears you're missing an __init__.py file. You need one in the directory to make python treat the folder as a package.

  • Related