0

I have a flask application running. If i need to pass the values from '/configs' to function 'data' and the result from the function data has to be returned to "/sumcollect" and has to be appended to the list named 'value'. How can we pass values like this.

def data(a,b):
    sum = a+b

@app.route("/configs")
def configs():
    a = 10
    b = 20
    data(a,b)

@app.route("/sumcollect")
def sumcollect():
    value = [10,20]
Aniiya0978
  • 274
  • 1
  • 9
  • Are you trying to redirect? That's what it sounds like, if so, this answer may help: https://stackoverflow.com/questions/17057191/redirect-while-passing-arguments – Leshawn Rice Sep 21 '21 at 17:36
  • you should keep `value` outside function - as global variable or in database - and `data` should `append()` to this `value` - and `sumcollect` should use this external `value` with already appended `sum` – furas Sep 21 '21 at 18:43

0 Answers0