Can't import mymodule in Python

Question:

I’m using VSCode and getting warning "search is not accessed in Pylance" when trying to import my own module, search is the name of the module I need to import to my main program

enter image description here

1- I do have __init__.py file on module folder

2- Tried changing interpreter

Importing mymodule as below:
from src import search

folder structure:

folder structure

Could the reason of this be that ‘src’ is being treated as a module instead of a folder?

enter image description here

Is there an alternative way to import my modules?

Thanks

Asked By: Elcoope

||

Answers:

The error "search" is not accessed means you are not using search,

enter image description here

If you use search below then this error will go away.

enter image description here

Answered By: JialeDu
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.