Again, what software is doing the password protection? I'm not aware of any built-in functionality in macOS that does that on folders unless you are using a disk image.
Chances are, you will need to write an AppleScript to interface with said program to unlock the folders but without more details I can't say for sure.