ive been trying my hand on using modules to make my codes cleaner.
i started off with a simple case.
i created a module, usermodule.py, which i will pass to a main program
openme.jpg - 640x480
#this is usermodule.py import Image #image = Image.open ('openme.jpg') #imload = image.load() def usermodule(x,y): return imload[xstart,ystart]
i then created a main program and pass usermodule.py to it:
#this is the mainprogram import Image , usermodule image = Image.open ('openme.jpg') imload = image.load() print usermodule.usermodule(1,1)
when i run the main program however, i get this error:
NameError: global name 'imload' is not defined
any light you can shed as to why this is happening is much appreciated. thanks