I'm trying to get my vscode project to mimic functionality that pycharm is able to produce. With pycharm, I'm able to create, via an XML, a custom pycharm project file that lists the various different sources of the different folder locations of the custom modules I need to have available.
In vscode, I'm going about this by creating a workspace file and adding these sources as folders in the JSON object. The workspace will populate properly in vscode, but when I try to reference an import, Intellisense is able to see the module I'm trying to import 1 but when I try to start a debug session, vscode barfs and says it can't find this module 2 .
My folder structure is:
workspace
|--> obscura
|-->|--> obscura
|-->|-->|--> database.py
|-->|--> obscura_test
|-->|-->|--> mytestfile.py --- where I'm starting debug session
Here are the screenshots:
-- Intellisense shows what the module is
-- Vscode fails on debug
This is what I did in my python project in VSCode
If my module is a class
from folder_name.python_file_name_without_extension import class_name
# then I can use it as follow
class_name.function_name()
If my module is just a script
from folder_name.python_file_name_without_extension import function_name
# then I can use it as follow
function_name()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.