'function with async parameter

I try to create a crawler in order to navigate on website. I want to use in several function the page I open at the beginning. However it's impossible to call in parameter the page opened in previous function. Is there a way to use it ? How can I call the opening page ?

# Code to open website
async def open(url_page):
    browser = await launch()
    page = await browser.newPage()
    await page.goto(url_page)
    print("Website Launch")

# code to apply my click function
asyncio.get_event_loop().run_until_complete(function_to_click(page))

Thanks you in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source