skip to Main Content

As you can see in image below, thread_processor and order_processor is in the same folder as main.py, yet it does not recognize as a module.
Its is looking only at the root folder ..

even adding below code in launch.json is not helping either … THanks

{
    
"configurations": [
    {
        "name": "Python",
        "type": "python",
        "stopOnEntry": false,
        "request": "launch",
        "pythonPath": "${config.python.pythonPath}",
        "program": "${file}",
        "cwd": "${workspaceRoot}",
        "debugOptions": [
            "WaitOnAbnormalExit",
            "WaitOnNormalExit",
            "RedirectOutput"
        ],
        "env": {
            "PYTHONPATH": "/src/order_processing_engine"
        }
    }
]
}

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    Add your folder in extraPaths as below

    {
        "python.analysis.extraPaths": [
            "./src/order_processing_engine"
        ]
    }
    

    enter image description here


  2. Since your folder is a package, you can use a relative import. E.g., from .thread_extractor import get_next_thread

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search