Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

Auto run python scripts on pycharm while opening

I want to auto run the python script when I open it from the terminal so that I won't have to press the run button From the terminal I want to open the file as : pycharm-community main.py

How do I auto run it while it opens?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Do File | Settings | Tools | Startup Tasks (or Ctrl-Alt-S).

Then: Build, Execution, Deployment > Console > Python Console

This gives you a dialogue with an edit box Starting script. Put your import code there. That will run every time you open a new console.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...