How to fix KiCAD JLCPCB fabrication plugin error: The wx.App object must be created first!

Problem:

When running the JLCPCB fabrication plugin in KiCAD to export fabrication data, you see the following error message:

wx._core.PyNoAppError: The wx.App object must be created first!

Solution

This appears to be a bug with current versions of the JLCPCB fabrication plugin, but you can easily fix it by adding a line to plugin.py, which is located here:

/home/uli/.local/share/kicad/6.0/3rdparty/plugins/com_github_bennymeg_JLC-Plugin-for-KiCad/plugin.py

(depending on the operating system, the kicad folder will be located elsewhere).

Find the following lines which are almost at the top of the file:

# WX GUI form that show the plugin progress
class KiCadToJLCForm(wx.Frame):
    def __init__(self):

and add the following line directly after def __init__(self):

        self.app = wx.PySimpleApp()

Result:

# WX GUI form that show the plugin progress
class KiCadToJLCForm(wx.Frame):
    def __init__(self):
        self.app = wx.PySimpleApp()