Any reference to a state variable must be prefixed with `self.` — this makes it visually unmistakable whether a line touches persistent storage (expensive, permanent) or a local/memory variable (cheap, temporary).
total: public(uint256)
@external
def add(amount: uint256):
local_copy: uint256 = self.total # read storage into memory
local_copy += amount
self.total = local_copy # write back to storageThis explicitness is one of Vyper's clearest departures from Solidity, where storage vs memory can sometimes be ambiguous at a glance (especially with struct/array references).