How to get coordinate of accessible grids

hello I am making a 2d platformer game and adjust grids according to grounds and it works as intended.

Now, I am trying make some enemies ascape from player. It was hard to implement but I got a idea. I want to learn how to get accessible grids for a specific unit.

if I get this grids, I will filter them according to player’s position so that ı can make a new destination for this unit. for expample I find a grid in for loop that is 20 grid away from player and define it destination for AI.

Also map full of grid of thereforeI need grids that are open for that specific unit. Like geting a list of all posible position that unit can go or reach according to prepared a star path finder.

Can you help Is it possible ?

It sounds like you might want this function: PathUtilities - A* Pathfinding Project