0

Class 1 (main): Aviation

Class 2/3 (not main, but need objects from this class): Airport, Flight

In Aviation class file I did the following:

from Flight import *

from Airport import *

but it did not import the objects from flight & airport since they are in different files

user28
  • 1

1 Answers1

0

You would have to import the file name. For example if the file name for class 2/3 is fly.py. You have to do from fly import Flight, Airport. Make sure they are in the same folder. If they aren't in the same folder, try this:

import sys

sys.path.insert(0, 'Path to your folder')
Darkshadogt
  • 49
  • 1
  • 5
  • How to put them in the same folder? – user28 Apr 12 '23 at 14:48
  • If you’re using vs code, you can drag the file to the folder. Else this link can be helpful, [link](https://stackoverflow.com/questions/4383571/importing-files-from-different-folder) – Darkshadogt Apr 12 '23 at 15:18