Python script to change input_boolean value

I’m trying to make a python file that I can run from the command line to change the state of an input boolean

I currently have a script with this single line:

hass.states.set(motionstate, on)

which is probably completely wrong

This is my terminal when I try to run the script:

➜  ~ python3 /config/python_scripts/setstatemotion.py
Traceback (most recent call last):
  File "/config/python_scripts/setstatemotion.py", line 1, in <module>
    hass.states.set(motionstate, 'on')
NameError: name 'hass' is not defined
➜  ~