Can't Set Desktop Background in Fullscreen App
I'm late to the party, but this should work for you:
-- Set user_project_path to the folder that contains this AppleScript
set user_project_path to POSIX path of ((path to me as string) & "::")
-- Assuming your images are contained in user_project_path directory inside an images folder
set images_directory to user_project_path & "images/" as string
tell application "System Events"
set desktopCount to count of desktops
repeat with desktopNumber from 1 to desktopCount
tell desktop desktopNumber
-- Change my-desktop-image.png below to the name with extension of your desired image
set picture to images_directory & "my-desktop-image.png"
end tell
end repeat
end tell
If you have questions, let me know