I am just wondering is it possible to start two functions to work in same time with Flask server? I need to start function_1 after it trigger function_2 and run both functions in same time. Is it possible?
def function_1():
yield "start_function_2"
counter = 0
while True:
counter += 1
print counter
def function_2():
second_counter = 0
while True:
second_counter += 1
print second_counter
def main():
return render_template("index.html")
@app.route("/start_functions", methods=["POST"])
def start_functions():
data = request.data
if request.method == "POST":
for i in function_1(data):
if (i == "start_function_2"):
function_2()
if __name__ == "__main__":
app.run(dhost="0.0.0.0", port=port)