I am new to python. I got Syntax Error: invalid syntax & object module is not callable
Thanks for your help
Spot.py
class Spot(object):
isBunny = bool()
UP = 0
SLEEP = 2
def __init__(self, newIsBunny):
self.isBunny = newIsBunny
self.nextCycle = self.UP
Test.py
import Spot
i=2
if i==Spot.SLEEP
a=Spot(True)
print a.isBunny
In addition to what Borgleader says, instead of
use
This should fix the “module is not callable” error.
When you say
then “Spot” is the whole module. Spot.Spot is the Spot class inside the Spot module, which is what you really want. Using the
from Spot import Spotsyntax lets you pull in just the Spot class from the Spot module, and call it Spot.