Cannot import .msg files from another folder (python) [closed]
Hello,
I have the following structure:
Package
|__"src"
|__"node.py"
|__"msg"
|__"message.msg"
|__"__init__.py"
I want to access the message.msg in the node.py, 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 ~
sys.path.append(package/msg)
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 __init__.py is empty
Am I messing up the path?
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.
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.