I have the following program:
daytime_images = os.listdir("D:/TR/Daytime/")
number_of_day_images = len(daytime_images)
day_value = 27
def find_RGB_day(clouds, red, green, blue):
    img = Image.open(clouds)
    img = img.convert('RGB')
    pixels_single_photo = []
    for x in range(img.size[0]):
        for y in range(img.size[1]):
            h, s, v, = img.getpixel((x, y))
            if h <= red and s <= green and v <= blue:
                pixels_single_photo.append((x,y))
    return pixels_single_photo
number = 0
for _ in range(number_of_day_images):
    world_image = ("D:/TR/Daytime/" + daytime_images[number])
    pixels_found = find_RGB_day(world_image, day_value, day_value, day_value)
    coordinates.append(pixels_found)
    number = number+1
EDITED I would want to execute the function using multiprocessor, so I tried:
for number in range(number_of_day_images):
    p = multiprocessing.Process(
        target=find_RGB_day,
        args=("D:/TR/IR_Photos/Daytime/" + daytime_images[number],27, 27, 27))
    p.start()
    p.join()
    number = number+1
    coordinates.append(p)
When executing it, a AttributeError happened and I don't know how to solve it:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
AttributeError: Can't get attribute 'find_RGB_day' on <module '__main__' (built-in)>
I think this error may be related with the way I introduce the images into the program, where I get all names from a folder and then select element per element with number= number+1
 
     
    