I was having the same problem and the solution was very simple: Save the file before running uvicorn. It sounds stupid but i'm using a new computer and didn't have auto save enabled. Writing this answer because it might help someone.