I wish to check if a record exists and then if it does i want to read the records in the other table. I am using the same cursor of the database that i created but it shows unresolved reference for the cursor inside the if block.
My code:

```
import psycopg2

conn=psycopg2.connect(host='localhost', database='my_first_db', user='postgres', password='postgres')
curr= conn.cursor()
res=curr.execute("select EXISTS(select * from teachers where t_name='xoxo' AND pass='xoxo2020')")
if curr.fetchone()[0]==1 :
    {
        curr.execute("select * from students")
        result=curr.fetchall()
        for x in result:
            print(x)
        #print('Table exists')
    }
else:
    print("not found")
print(res)
curr.close()
conn.close()

```

the curr in the second line of if block shows the unresolved error.
Thanks.