Module uncallable? Unsure how to fix
Question: I am just beginning with python and I've run in to an error I don't know how
to fix. Please see the code examples below. I run `event_timer.py` and I get
the following error message. Both of the files listed below are in the same
folder.

    
    
    Traceback (most recent call last):
      File "E:\python\event_timer\event_timer.py", line 7, in 
        timer = EventTimer()
    TypeError: 'module' object is not callable
    

Can someone tell me what I'm missing?

**event_timer.py:**

    
    
    import EventTimer
    
    timer = EventTimer()
    
    timer.addStep("Preheat Oven", seconds = 10)
    timer.addStep("Cook Pizza", seconds = 20)
    timer.addStep("Done!")
    
    timer.start()
    

**EventTimer.py:**

    
    
    import time
    
    class Timer:
    
        event = 'Event'
        steps = []
    
        def __init__(self, event = None):
    
            if event is not None:
    
                self.event = event
    
        def addStep(self, step, seconds = None, minutes = None, hours = None, days = None):
    
            if seconds is not None:
    
                unit = 'seconds'
                amount = seconds
    
            elif minutes is not None:
    
                unit = 'minutes'
                amount = minutes
    
            elif hours is not None:
    
                unit = 'hours'
                amount = hours
    
            elif days is not None:
    
                unit = 'days'
                amount = days
    
            else:
    
                print 'Invalid arguments'
    
                return False
    
            self.steps.append({'unit': unit, 'amount': amount})
    
            return True
    
        def __timeInSeconds(self, unit, amount):
    
            if unit == 'seconds':
    
                return amount
    
            elif unit == 'minutes':
    
                return amount * 60
    
            elif unit == 'hours':
    
                return amount * 60 * 60
    
            elif unit == 'days':
    
                return amount * 60 * 60 * 24
    
            else:
    
                print 'Invalid unit'
    
                return False
    
        def start(self):
    
            if len(self.steps) == 0:
    
                print 'No steps to complete'
    
                return False
    
            print "{0} has started.".format(self.event)
    
            for step in self.steps:
    
                print step.step
    
                time.sleep(self.__timeInSeconds(step.unit, step.amount))
    
                print "Completed"
    
            print 'Event complete'
    


Answer: When you write

    
    
    import EventTimer
    

you make a new variable, `EventTimer`, pointing to a _module_ \-- the module
that you've just written! Inside that module is a class, `Timer`. So to make
an instance of that class, you do

    
    
    timer = EventTimer.Timer()
    

