Ghost AI not moving through intersections (Phaser 3, PacMan)

I am trying to make a pac_man game with Phaser 3. I have implemented the pac_man movement, however, I really need help with the ghost AI. The ghost is moving my its self, however, it is not passing through any intersections. Like, it only moves in a different direction when it collides with something else. I am trying to fix this, and yet I don’t know how. I am using physics, with arcade. Here is some of the code:

newDirections(sprite) {
        let directions = ['left', 'right', 'down', 'up']
        let object = sprite.body.blocked
        let keys = Object.keys(object)
        let new_directions = []
        for (let i = 1; i < keys.length; i++) {
            if (object[keys[i]] == false ) {
                new_directions.push(keys[i])
            }
        }
        return new_directions
    }

This function is supposed to see any other paths the ghost can take. I am highly depended on sprite.body.blocked for this (especially since I am using tiles), but it only reads when the sprite is colliding with something else. Any help will be heavily appreciated. Thank you so much in advance!