Import external kv files from another package

37 views
Skip to first unread message

Javier Uribe

unread,
May 8, 2019, 4:06:08 AM5/8/19
to Kivy users support
Hi, I'm trying to standarize some kivy applications so I want to extract functionality, as far it has been well with the python files, but with the kv files I have been not that lucky. I can't find a way to import kv files from an external package. I have tried something like:
#:include force package.file.kv

I have tried as well with the python way:
from kivy.lang import Builder
Builder.load_file('package.file.kv')



Javier Uribe

unread,
May 8, 2019, 6:51:37 AM5/8/19
to Kivy users support
After a lot of attempts I have discovered how.
import module
from os.path import join
from kivy.lang import Builder
Builder.load_file(join(module.__path__._path[0], file_name))
Apparently with the python way it is possible if we pass it as parameter the module's path..

Reply all
Reply to author
Forward
0 new messages