'create an import function buttonn in kivy

I want to create an 'import' Button that chooses a file from Desktop:

I tried this but it's not working :

The .py file

def load(self):
    import os
    path = os.path.dirname(os.path.realpath(__file__))
    sys.path.append(path)

The .kv file :

Button:
     text: "Load"
     on_release: root.load()


Sources

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

Source: Stack Overflow

Solution Source