Can I switch between desktop and web automation in a single script?

Can I switch between both in a single script?

Yes you can need only to change this command xdesktopautomation

https://ui.vision/rpa/x/desktop-automation#xdesktopautomation