Thanks @jshaffstall for your kind follow up, but I am sorry I can’t share a copy of the app where I can share the entire process
This is the very first HomePage
class Homepage(HomepageTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
self.task = anvil.server.call_s('get_x_back')
self.load_home_page_cont()
# here is a function that loads the first HomePage content
def load_home_page_cont(self):
self.content_panel.add_component(HomePageContent(task_2 = self.task), full_width_row=True)
And this is the HompePageContent page which loads the last page (our destination)
class HomePageContent(HomePageContentTemplate):
def __init__(self, task_2, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
self.column_panel_1.add_component(LastPage(task_2), full_width_row=True)
And finally this is the last page where I am trying to access both of the tasks
class LastPage(EURRatesTemplate):
def __init__(self, task_1, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
global task_2
task_2 = task_1
self.task = anvil.server.call_s('get_y_back',"EUR")
self.timer_1.interval = 1
def timer_tick(self, **event_args):
self.timer_1.interval = 0 # stop the timer while we check the background task
my_data = None
if self.task:
with anvil.server.no_loading_indicator:
my_data = self.task.get_return_value() # None if nothing is yet returned
if my_data is not None:
GlobalVars.x_data= my_data
self.task = None
else:
self.timer_1.iterval = 1
def timer_projects(self, **event_args):
self.timer_2.interval = 0
alert("here")
my_data = None
if task_2:
with anvil.server.no_loading_indicator:
my_data = task_2.get_return_value() # None if nothing is yet returned
if my_data is not None:
GlobalVars.y_data= my_data
task_2 = None
else:
self.timer_2.iterval = 1
So far here is the entire background_task server side
@anvil.server.callable
def get_x_data_back(currency, time):
task = anvil.server.launch_background_task('get_x_data_backgrond',currency, time)
return task
@anvil.server.background_task
def get_x_data_backgrond(currency, time):
# here I am calling the function on my external server
my_data = anvil.server.call('get_x', currency,time)
return my_data
@anvil.server.callable
def get_x_data_back():
task = anvil.server.launch_background_task('get_y_data_backgrond')
return task
@anvil.server.background_task
def get_y_data_backgrond():
#Also here I am calling the function on my external server
my_data = anvil.server.call('get_y')
return my_data