[英]Can't import mymodule in Python
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我正在使用 VSCode 并在尝试导入我自己的模块时收到警告“在 Pylance 中未访问搜索”,搜索是我需要导入主程序的模块的名称
1- I do have __init__.py
file on module folder 1-我在模块文件夹中有
__init__.py
文件
2- Tried changing interpreter 2-尝试更换口译员
Importing mymodule as below: from src import search
导入 mymodule 如下:
from src import search
folder structure:文件夹结构:
Could the reason of this be that 'src' is being treated as a module instead of a folder?原因可能是“src”被视为模块而不是文件夹吗?
Is there an alternative way to import my modules?有没有其他方法可以导入我的模块?
Thanks谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.