Search code examples
pythonxmladd-onxbmckodi

How can I run an addon in the service addon in Kodi with python


I am developing kodi add-ons using python scripts and xml's.I created an service addon will be automatically started when Kodi start. The part that in addon.xml work for this job is in here:

extension point="xbmc.service" library="addon.py" start="login" />

When this addon.py work,a button appears in the screen. My goal is when you pushed these button;another add-on should work. The code section in addon.py(service addon's python script)
I wrote to handle this part is here:

if control=self.button0:
    file_path=xbmc.translatePath(os.path.join("...\addons/script.helloworld\addon.py"))
xbmc.executebuiltin("xbmc.RunScript(file_path)")

But these errors appears in kode.log

ERROR:CScriptInvocationManager::ExecuteAsync-Not executing non-existing script file path


Solution

  • You can just do this and everything should work.

    xbmc.executebuiltin("RunScript(script.addonid)")