Maze won't backtrack [Python] : There are a couple of maze questions similar to this one but none of them ever really go into the why it won't work.

This is for an assignment for my summer class. I don't need precise answers. I just need to know why this particular thing doesn't work.

This is the bit of my class Maze that I need help with.

ysize in my example is 10
xsize is 10
xend is 20 (changing it to 19 messes with the results and doesn't draw anything)
yend is 10 (changing it to 9 does this too)


'''

    def solve(self, x, y):
        
        
        if y > (self.ysize) or x > (self.xsize):
            print("1")
            return False
        
        if self.maze[y][x] == self.maze[self.yend][self.xend]:
            print("2")
            return True 
    
        if self.maze[y][x] != " ":
            print("3")
            return False
        
    
    
        self.maze[y][x] = "o" # MARKING WITH o for path already taken.
        
        if self.solve(x+1,y) == True:  

            return True
        elif self.solve(x,y+1) == True: 

            return True
        elif self.solve(x-1,y) == True:

            return True
        elif self.solve(x,y-1) == True: 

            return True
        
        self.maze[y][x] = " " # ELSE I want it to be replaced with space
        
        return False


'''

The expected result is the solved maze with a trailing path of "o" from 1 1 to 9 19 as per the current file. 
However what I get is a path from 1 1 to 13 4 (x)(y) format.
There is a dead end around 13 4 and it won't backtrack to go up and left. Sorry if it doesn't make that much sense but copy pasting the drawing doesn't turn out well.