Skip to content

Feature Request: Add Setting to Run File as Module #25373

@Sazzzzzz

Description

@Sazzzzzz

In Python, files with relative imports need to be run as a module using python -m module.submodule instead of as a script (python module/submodule). This is especially important for executing the main() block within submodules for testing purposes.

Currently, there doesn’t seem to be an easy way to add the -m flag and convert the path from module/submodule to module.submodule when using the Python: Run File task. This limitation also makes it challenging to achieve the same behavior in debug mode.

It would be incredibly helpful if the extension provided a setting to enable running files as modules directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalitytriage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions