Unresolved import 'anvil.server'

a problem could be that you seem to have pip installed both anvil and anvil-uplink

these may have conflicts since the pypi package named anvil is not associated with anvil.works.

Things to try:

pip uninstall anvil
pip3 install anvil-uplink 
# sometimes pip3 may be required depending on how python is running locally

also check out this thread

in your script

import anvil
print(anvil.__file__) 
# you may not be importing the anvil-uplink pypi package but something else
# go to this file and see what it is - change the name of the file, rinse and repeat
print(dir(anvil))
# BlobMedia, Button, ...
# if you don't get the obvious anvil dir then you are importing the wrong anvil

You can also try running the uplink script in a virtual environment.
The advantage here is that you install packages within the virtual environment rather than globally.