Global name 'find_element_by_xpath' is not defined

Hi,

I keep getting this error when trying to select an element ‘find_element_by_xpath’. Unfortunately it’s only accessible by xpath. Am I missing something? I’ve already imported webdriver…

Python code:

from appium import webdriver
from appium.webdriver.common.touch_action import TouchAction

createaccButton = find_element_by_xpath(’//*@name=“foo"’)[2]

Error I’m getting:

Traceback (most recent call last):
File “working.py”, line 106, in test_create
createaccButton = find_element_by_xpath(’//*@name=" foo"’)[2]
NameError: global name ‘find_element_by_xpath’ is not defined

In Appium inspector this is the xpath fort the element

(//XCUIElementTypeOther[@name=" foo "])[2]