Error: "self" is not defined error on VSCode on Ubuntu

I’m following a tutorial on understanding writing python publisher in ROS2. This is an example that I’m creating. The code does not seem to have any errors but in vscode, the self word is underlined in red and when I hover the mouse it shows that "self" is not defined. How can I resolve this… Read More Error: "self" is not defined error on VSCode on Ubuntu