[Python] How to rerun running main.py in Pycharm using Shell or Python?

Discussão em 'Python' iniciado por Stack, Janeiro 24, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to create script or some code template to rerun main.py server for some reasons. Is it possible to do using Shell or some Python code?

    I tried this Shell script:

    #!/bin/bash

    osascript <<EOF
    tell application "PyCharm" to activate
    delay 1 # Give it a moment to fully focus
    tell application "System Events"
    keystroke "r" using control down
    end tell
    EOF


    But it not work as expected, it sometimes runs inside terminal, or run smth weird.

    Continue reading...

Compartilhe esta Página