title: Python 3 ModuleNotFoundError: No module named 'lot'
body: <p>I am trying to run a python3 unit test script but it gives me a module not found error when it uses objects from the main scipt and comes across import statements. I don't face this error when I run the main script itself and the code run as expected. The error traceback that I get is:</p>
  
  <pre><code>Traceback (most recent call last):
    File "parkingLot_test.py", line 3, in &lt;module&gt;
      from source import parking  
    File "/home/stash/Desktop/parking-lot/parking-lot-1.4.2/parking_lot/parking_lot/bin/source/parking.py", line 1, in &lt;module&gt;
      import lot
  
  ModuleNotFoundError: No module named 'lot'
  </code></pre>
  
  <p>The directory structure is as follows:</p>
  
  <pre><code>├── file_inputs.txt
  ├── parking_lot
  ├── parkingLot_test.py
  ├── run_functional_tests
  ├── setup
  └── source
      ├── car.py
      ├── __init__.py
      ├── lot.py
      ├── main.py
      ├── parking.py
  </code></pre>
  
  <p>The code for unit test file <strong>parkingLot_test.py</strong>:</p>
  
  <pre><code>import unittest
  from source import parking  
  
  class ParkingTest(unittest.TestCase):
  
      @classmethod
      def MakeClass(cls):
          cls.parking = parking.Parking()
          cls.allocated_slot = 1
  
      def test_a_create_parking_lot(self):
          parking_slots = 6
          self.parking.create_parking_lot(parking_slots)
          self.assertEqual(len(self.parking.slots), parking_slots,
                           msg="Wrong parking lot created")
  
      def test_b_park(self):
          registration_no = "MH-12-FF-2017"
          colour = "Black"
          self.parking.park(registration_no, colour)
          self.assertFalse(
              self.parking.slots[self.allocated_slot].available, "Park failed.")
          for i in self.parking.slots.values():
              if not i.available and i.car:
                  self.assertEqual(i.car.registration_no,
                                   registration_no, "Park failed")
                  self.assertEqual(i.car.colour, colour, "Park failed")
  
      def test_c_leave(self):
          self.parking.leave(self.allocated_slot)
          self.assertTrue(
              self.parking.slots[self.allocated_slot].available, "Leave failed.")
  
      @classmethod
      def RemoveClass(cls):
          del cls.parking
  
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>The code for the imported file <strong>parking.py</strong>:</p>
  
  <pre><code>import lot
  import car
  
  
  class Parking:
      """
      Parking class which has details about parking slots
      as well as operation performed on parking are present here
      """
  
      def __init__(self):
          self.slots = {}
  
      def create_parking_lot(self, no_of_slots):
          """This method will create parking lot if not present already with given
          number of slots.
          Input: no_of_slots - Integer Type
          """
          no_of_slots = int(no_of_slots)
  
          if len(self.slots) &gt; 0:
              print("Parking Lot already created")
              return
  
          if no_of_slots &gt; 0:
              for i in range(1, no_of_slots+1):
                  temp_slot = lot.ParkingSlot(slotNum=i,
                                              availability=True)
  
                  self.slots[i] = temp_slot
              print("Created a parking lot with %s slots" % no_of_slots)
          else:
              print("Number of slots provided is incorrect.")
          return
  
      def get_nearest_available_slot(self):
    ...................
  </code></pre>
  
  <p>How can I fix this issue?</p>