Cannot import .msg files from another folder (python) [closed]

asked 2021-11-25 03:53:07 -0500

WarTurtle gravatar image

updated 2022-01-31 09:45:41 -0500

lucasw gravatar image


I have the following structure:


I want to access the message.msg in the, but when I try to import it, I get the pylance error

Import "msg.msg" could not be resolved

I tried

from msg.msg import message.msg
from package.msg import message.msg

import sys
sys.path.append(~/workspace/src/package/msg) #with and without the ~

And none of it works.

I followed the Creating A Message tutorial and added all the relevant dependencies in the package.xml and CMakeLists.txt, and everything also compiles fine. The is empty

Am I messing up the path?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by gvdhoorn
close date 2021-11-25 04:13:26.310214


I'm closing this as a duplicate of #q270568.

That question discusses a similar problem, and I believe the solution offered there should also help you.

If you don't agree, or something is still unclear, edit your question here to clarify why/what doesn't work for you.

gvdhoorn gravatar image gvdhoorn  ( 2021-11-25 04:13:04 -0500 )edit

Please do not delete questions if they are duplicates and have references to what they are duplicates of.

It's perfectly valid to keep your question around. We should just avoid posting duplicate answers.

gvdhoorn gravatar image gvdhoorn  ( 2021-11-25 04:37:42 -0500 )edit