Push Files to real android device

Hello, I am trying to change a file with appium before opening my application to execute the steps for the automated test.

import base64
import self as self

def pushfisier():

data = open("D:\\xx\\xx.json", "r").read()
strcode = str.encode(data)
encoded = base64.b64encode(strcode)
self.driver.push_file('//storage//sdcard0//xx', encoded);

But when i run the script i got this error : AttributeError: module ‘self’ has no attribute ‘driver’
What Should I do ? Thanks!