Need help with Correct pathfinding

I need help or advise on how to configure AI to find a path for the enemy behind the wall. If both of them are close to the wall, AI won’t try to find a better spot to shoot.

I will appreciate any advise.