FootprintLoad does not work on Linux (Python Script)

Hello,

I am trying to design a layout solely on python. On my windows and linux machines I have kicad installed.

On windows when I execute following script on python

import pcbnew
enc_fp =  pcbnew.FootprintLoad(r"C:\Users\user\Desktop\PCB_Design\KiCad_Libs\Encoder\PEC12R-4025F-S0024.pretty", r"PEC12R-4025F-S0024")
type(enc_fp)

Output:
<class 'pcbnew.FOOTPRINT'>

However when I run the code on linux machine,

import pcbnew
enc_fp =  pcbnew.FootprintLoad(r"/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs/Encoder/PEC12R-4025F-S0024.pretty", r"PEC12R-4025F-S0024")
type(enc_fp)

Output:
<class 'NoneType'>

I am have tried setting Footprint path such as,

r"/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
r"~/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
r"~/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
r"/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
"/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
"~/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
"~/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
"/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"

This how the file system is created:

None of them seemed to return the footprint class to the variable. I can ‘cd’ into everyone of those directories without superuser. I have used ‘pwd’ bash command to get the exact directories as well. I have also tried flashing a fresh OS then installing the kicad too, result is again was the same.

Can you open that footprint through UI on linux? Maybe your installed kicad version is different there?