Using Password Variable in Jython Script Task

Password variable can only be used in password fields otherwise it will throw an error as below

The task could not start because the following variables could not be replaced: ${pass}. Ensure that global and folder variables are defined, there is no circular references, password variables are only used in password fields, and other variables are only used in non-password fields.

Follow this doc as a guide to use the password in the non-password field

Another most popular question is using the password variable in Jython script task:
As of the current version (July 2020) by default scripting, sandbox security is enabled
Here is some info to disable and decrypt the password

You could decrypt the password in your Jython scripts but I would recommend using that in a plugin instead of a Jython script so that it is hidden from the users. You could also plan to restrict the Jython script task to only a limited set of users if you have to use this method in the Jython script task.
Check out this code snippet to decrypt