If macOS doesn’t remember the Security & Privacy Access that you granted:
Try Resetting the TCC Service
Try the tccutil reset commands as described in Granting Full Disk Access or Granting Automation Access.
Try Reinstalling the Application
Make sure that the application file is not damaged, e.g. by reinstalling a fresh copy. Also, make sure that you are not modifying the application package, e.g. editing its Info.plist file to try to hide the Dock icon.
Try Resetting the Privacy Database
If it still doesn’t work, you may need to reset the entire privacy database:
First, we will temporarily turn off System Integrity Protection so that we have access to delete the database. You may want to print these instructions or write them down so that you have access to them while rebooting your Mac.
Restart your Mac in Recovery Mode. The steps for doing this depend on which type of processor your Mac has:
From the Utilities menu, choose Terminal.
Type csrutil disable and press Return.
Click on the Apple menu and choose Restart. This is necessary for the SIP change to take effect.
Drag the file:
/Users/<username>/Library/Application Support/com.apple.TCC/TCC.db
to the trash. (See How can I open the Library folder? if you have trouble finding it.)
You can then repeat Steps 2–5, typing csrutil enable instead, in order to turn SIP back on.
Try Reinstalling macOS
If it still doesn’t work, reinstalling macOS takes a while but always seems to fix the problem.