This function is intended to return lists containing the path and names of .tif files stored in a directory. However, when this function is ran the variables pthlist and nmlist are not visible in the Variable Explorer or printable.
def pathList (d): # input is directory path
    pthlist = [] # creating empty path list of .tif files in directory
    nmlist = [] # creating empty name list of .tif files in directory
    
    for item in os.scandir(d):
    
        if item.name.endswith(".tif"): 
             pthlist.append(os.path.join(d, item.name))
             nmlist.append(item.name) 
            
   return pthlist, nmlist
 
    