title: Getting a name error NameError, function is not defined?
body: <blockquote>
    <p>File "/Users//Desktop/A5/driverModule.py", line 22, in controller
        tripInfo()
    <strong>NameError: name 'tripInfo' is not defined</strong></p>
  </blockquote>
  
  <p>Okay I'm really stuck and can't figure out why I'm getting this error. Any help is appreciated. </p>
  
  <p>Driver Module</p>
  
  <pre><code>from TripInfoModule import *
  
  
  def controller():
  totalDrivingTime = 0
  totalFuelCost = 0
  totalAmountEarned = 0
  totalNetIncome = 0
  totalDistance = 0
  totalFuelComsumed = 0
  totalBreakTime = 0
  
  input("Welcome to the updated trip income calculator. Press enter to continue: ")
  i = "y"
  while i == "y":
      getDistance()
      getEarningpPerMile()
      getDrivingTime()
      getBreakTime()
      getFuelConsumed()
      getCostperGallon()
      tripInfo()
  
      i = input("Would you like to add a new trip? Enter y to add a new trip, "
            "or enter n to exit.")
  print("Total fuel cost: $", format(totalFuelCost, '.2f'))
  print("Total amount of fuel consumed:", format(totalFuelComsumed, '.2f'), "gallons")
  print("Total miles driven:", format(totalDistance, '.2f'), "miles")
  print("Total driving time:", format(totalDrivingTime, '.2f'), "hours")
  print("Total break time:", format(totalBreakTime, '.2f'), "hours")
  print("Total earned: $", format(totalAmountEarned, '.2f',))
  print("Total net income: $", format(totalNetIncome, '.2f'))
  
  
  def main():
  controller()
  
  
  main()
  </code></pre>
  
  <p>Module 2</p>
  
  <pre><code>from userInputModule import *
  
  import driverModule
  
  def tripInfo():
  getNetIncome()
  getTotalFuelConsumed()
  getAmountEarned()
  getNetIncome()
  getTotalBreakTime()
  getTotalDistance()
  getTotalFuelConsumed()
  getTotalDrivingTime()
  
  def getFuelCost():
  fuelConsumed = getFuelConsumed()
  costPerGallon = getCostperGallon()
  totalFuelCost = driverModule.controller()
  
  gasUsed = float(fuelConsumed)
  costPerGal = float(costPerGallon)
  
  fuelCost = gasUsed * costPerGal
  totalFuelCost += fuelCost
  
  print("Your total fuel cost is:", format(fuelCost, '.2f'))
  
  return fuelCost, totalFuelCost
  
  
  def getAmountEarned():
  distance = getDistance()
  earnings = getEarningpPerMile()
  totalAmountEarned = driverModule.controller()
  
  distanceVar = float(distance)
  earningsVar = float(earnings)
  
  amountEarned = distanceVar * earningsVar
  totalAmountEarned += amountEarned
  
  print("Your earnings are:", format(amountEarned, '.2f'))
  
  return amountEarned, totalAmountEarned
  
  
  def getNetIncome():
  totalNetIncome = driverModule.controller()
  fuelConsumed = getFuelConsumed()
  costPerGallon = getCostperGallon()
  distance = getDistance()
  earnings = getEarningpPerMile()
  
  gasUsed = float(fuelConsumed)
  costPerGal = float(costPerGallon)
  
  distanceVar = float(distance)
  earningsVar = float(earnings)
  
  earnedIncome = distanceVar * earningsVar
  
  fuelCost = gasUsed * costPerGal
  taxAmount = earnedIncome * .08
  netIncome = (earnedIncome - taxAmount) - fuelCost
  
  totalNetIncome += netIncome
  
  print("Your net income is:", format(netIncome, '.2f'))
  
  return netIncome
  
  
  def getTotalBreakTime():
  breakTime = getBreakTime()
  totalBreakTime = driverModule.controller()
  
  breakTimeVar = float(breakTime)
  totalBreakTime += breakTimeVar
  
  return totalBreakTime
  
  
  def getTotalDistance():
  distance = getDistance()
  totalDistance = driverModule.controller()
  
  distanceVar = float(distance)
  totalDistance += distanceVar
  
  return totalDistance
  
  
  def getTotalFuelConsumed():
  fuelConsumed = getFuelConsumed()
  totalFuelConsumed = driverModule.controller()
  
  fuelConsumedVar = float(fuelConsumed)
  totalFuelConsumed += fuelConsumedVar
  
  return totalFuelConsumed
  
  
  def getTotalDrivingTime():
  drivingTime = getDrivingTime()
  totalDrivingTime = driverModule.controller()
  
  drivingTimeVar = float(drivingTime)
  totalDrivingTime += drivingTimeVar
  
  return totalDrivingTime
  </code></pre>
  
  <p>Module 1 </p>
  
  <pre><code>def getDistance():
  distance = input("Please enter the number of miles driven: ")
  distanceStr = distance.replace(".", "")
  
  while not distanceStr.isnumeric():
      distance = input("Please enter a numeric distance "
                             "only that is non-zero: ")
      distanceStr = distance.replace(".", "")
  
  return distance
  
  
  def getEarningpPerMile():
  earningsPerMile = input("Please enter the amount earned per mile: ")
  earningsPerMileStr = earningsPerMile.replace(".", "")
  
  while not earningsPerMileStr.isnumeric():
      earningsPerMile = input("Please enter a numeric number "
                             "only that is non-zero: ")
      earningsPerMileStr = earningsPerMile.replace(".", "")
  
  return earningsPerMile
  
  
  def getDrivingTime():
  totalDrivingTime = input("Please enter total driving time: ")
  totalDrivingTimeStr = totalDrivingTime.replace(".", "")
  
  while not totalDrivingTimeStr.isnumeric():
      totalDrivingTime = input("Please enter a numeric number "
                             "only that is non-zero: ")
      totalDrivingTimeStr = totalDrivingTime.replace(".", "")
  
  return totalDrivingTime
  
  
  def getBreakTime():
  breakTime = input("Please enter the amount of break time taken: ")
  breakTimeStr = breakTime.replace(".", "")
  
  while not breakTimeStr.isnumeric():
      breakTime = input("Please enter a numeric number "
                             "only that is non-zero: ")
      breakTimeStr = breakTime.replace(".", "")
  
  return breakTime
  
  
  def getFuelConsumed():
  fuelConsumed = input("Please enter the ammount of fuel consumed: ")
  fuelConsumedStr = fuelConsumed.replace(".", "")
  
  while not fuelConsumedStr.isnumeric():
      fuelConsumed = input("Please enter a numeric number "
                             "only that is non-zero: ")
      fuelConsumedStr = fuelConsumed.replace(".", "")
  
  return fuelConsumed
  
  def getCostperGallon():
  costPerGallon = input("Please enter cost per gallon: ")
  costPerGallonStr = costPerGallon.replace(".", "")
  
  while not costPerGallonStr.isnumeric():
      costPerGallon = input("Please enter a numeric number "
                             "only that is non-zero: ")
      costPerGallonStr = costPerGallon.replace(".", "")
  
  return costPerGallon
  </code></pre>