3

i have two files, and i want to run both. The first one is basically asking down the prices of stocks and writes them to a database, and the second one using python dash to create a webpage. This webpage is showing the data in real time from the database which is constantly refreshes. I tried to use threading but it does not work, because the two files basically function as two infinite while loop. How should i solve this problem? The two functions im having problem with are dataMiningScript= fd.financeData(database,1600) and if name == "main": app.run_server(debug=True)

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
database=db.dataBase()
homepage=hp.homepage(database)
homepage.timeUpdateCallback(app)
homepage.gaugeRefreshCallback(app)
dataMiningScript= fd.financeData(database,1600)

app.layout = homepage.layoutMaker()



if __name__ == "__main__":
   app.run_server(debug=True)
1
  • 3
    A simple way is to run one of the scripts outside visual studio code... You can do that directly from a command line terminal/console or if you prefere from idle. Commented Sep 29, 2021 at 9:40

3 Answers 3

3

For some reason i cannot run two python programs at the same time in Visual Studio Code, but i managed to solve this problem with the solution of the first commenter:

I opened terminal and search my .py program. Then i write

python3 xy.py

Sign up to request clarification or add additional context in comments.

Comments

2

You can just create two terminals in visual studio code to run both files (see here). Or you can create a simple shell script which starts both programs (start a program in the background with a '&' at the end of the command line)

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
1

Helpful discussion here: run multiple python scripts at the same time.

Covers the question posted at the title fairly well.

On new window I managed to run the necessary code by typing a command. Run Python File button remains tied too original window.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.