I created a pair of programs for a Raspberry Pi Model B V1.2 running Python 2.7.13. One, a module containing a class and functions and the other a simple example program utilizing the module.
This is the class module, saved as "motor_library.py"
class Motor(object):
def __init__(self, name, pin1, pin2, pin3, pin4):
...
def callMotor(self, direction, stepNumber, delay):
...
This is the example program.
import motor_library
motor1 = Motor('motor1',4,17,23,24)
motor1.callMotor(1,1000,1)
After running the example program I get the error "NameError: name 'Motor' is not defined." Both files are in the same directory and I can't figure out what's causing the error. After some searchin I can't find anyone with a similar issue, anyone able to lend a hand?