I have been playing around with scripts for a couple of weeks and have not had any issues, but I am now trying to create a class and am running into problems.
I don't fully understand it myself but I am getting this error NameError: global name 'instance_status_check' is not defined
when I try to create an instance of the following class.
I am fully aware the class isn't doing much at this time but I can't move on until I resolve the problem. Can someone explain what I am doing wrong?
import sys
import boto
import boto.ec2
class Monitor:
def __init__(self,conn,identifier):
self.connection = conn
self.identifier = identifier
self.dispatcher ={'1': instance_status_check}
def user_menu():
for i, value in self.dispatcher.itertems():
print "Please press {i} for {value}".format(i,value)
def instance_status_check():
pass