yes. Although the D7 visa is commonly known as the passive income visa, it’s also suitable for freelancers and remote workers who get paid by companies outside Portugal.
You should also read some of the previous threads on here for discussion around remote work considerations, as visas, tax and insurance have all been covered fairly recently