Home > Blockchain >  Can't import mymodule in Python
Can't import mymodule in Python

Time:09-08

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

CodePudding user response:

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

  • Related