'How to pass values from shared steps defined in conftest.py to the tests in pytest-bdd?

I have a feature file with backgrouned steps defined in conftest.py. I want to access that step objects in my actuall test. How can I achieve this? Below is the example.

exmpl.feature

Freature: login and test connection
 Background: 
   Given Loging to testsite
 scenario Outline:
   When ckick on connection
   Then Should display the connection details
   Examples: 
       |----|---|----|

Conftest.py

@given('Loging to testsite')
def login():
    #Here I open test site
    #And I need to access this driver in my actual  test.( HOW..??)

test_exmpl.py

scenarios(FEATURE_FILE)
def test_connection():
    pass

@when('ckick on connection')
def connection():
    #I need the driver here which has got created in conftest.py(HOW..??)



Sources

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

Source: Stack Overflow

Solution Source