Unresolved reference red line error when using from import* and sys.path.append("..")

Answered

Hello PyCharm Community,

PyCharm shows a wavy redline for a "from import"-statement although the statement itself is valid:

    from NBDocxHelper import *

NBDocxHelper.py is part of the parent directory of the current files directory and I have added a sys.path.append("..")

I have included a screen shot.

I am using PyCharm 2021.1

The programms works but the error message is a little annoying.

Are there any options to avoid this error?

Regards,

Peter

 

0
3 comments

Have you tried marking the folder containing NBDocxHelper as Sources Root (right-click the folder and choose Mark Directory as | Sources Root)?

2

Hello Sergey,

That was the reason. I didn't know about this option.

Kind regards,

Peter

1

Marking directories is such a non-intuitive, obscure and nuanced thing to need to know about PyCharm. I've been using PyCharm for years and even I still get tripped up on this time and again.

0

Please sign in to leave a comment.