Why is the "import" command not being recognized? [closed]
I'm using ROS noetic in a ubuntu 20.04 machine but "import" command is not working when i write a code in python. First, i run the code using the python3 interpreter (python3 filename.py) and it works, but when i use rosrun the "import" command is not recognized and the console prints this error
/home/krisv/Documentos/ros_ws/src/krisv_first_package/scripts/talker.py: línea 4: import: orden no encontrada
/home/krisv/Documentos/ros_ws/src/krisv_first_package/scripts/talker.py: línea 5: import: orden no encontrada
from: can't read /var/mail/std_msgs.msg
/home/krisv/Documentos/ros_ws/src/krisv_first_package/scripts/talker.py: línea 9: error sintáctico cerca del elemento inesperado `('
/home/krisv/Documentos/ros_ws/src/krisv_first_package/scripts/talker.py: línea 9: `def talker():'