Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>py_run_constructorNew to Visual Studio Code? Get it now.
py_run_constructor

py_run_constructor

katzen-j

|
2,684 installs
| (1) | Free
Construct and generate a python run line
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

py_run_constructor README

Create python run or import constructors. All three methods will automatically copy the run or import script to the clipboard enabling a quick and easy paste to the command line to run a python script or generate the import for a file header. For example, create these:

code> python -c "from src.test_folder.python_test_file import *;function01()"
 from src.test_folder.python_test_file import function01
 from src.test_folder.python_test_file import TestClass

Python Runscript Constructors:

Create a python runscript for the command line and copy to clipboard.
The default keyboard shortcut is Shift(⇧)+Cmd(⌘)+A (ctrl for Windows).
This can be done in one of two ways.

  1. [Default] Using the keyboard shortcut whilst a python function is selected will output:
    python -c 'from root.folder1.file import *;function()'
    If you select/click on a line with a function on it, it will automatically select the function in the notification. If no function is selected, 'add_function_here()' will be displayed instead.

  2. Go to settings and select 'function_fullscript_switch' to run a whole python script - useful if you use if __name__ == "__main__" etc:
    python root/folder1/folder2/python_file.py

Note:

Python version can be changed in settings. This will change the prefix python to e.g. python3

Python Import Functionality:

If you would like to construct the import function inside of a python file and copy this to the clipboard.
The default keyboard shortcut Shift(⇧)+Cmd(⌘)+2 (ctrl for Windows).
This will output in the following format:

  • from folder1.folder2.python_file import function_selected
    • If you select/click on a line with a function on it, it will automatically select the function in the notification. If no function is selected, 'add_function_here' will be displayed instead.

Other:

In settings you can:

  • Toggle between function generate and fullscript generate
  • Change the status bar notification delay time
  • Toggle on a pop-up notification on or off
  • Change the python version to eg python3
  • Toggle select of Class from a sub-function or the function itself
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft