Has anyone figured out a workaround for not being able to import in hassio python scripts? I just moved over to hassio and want to implement a script like this, but the python_script section in hassio doesn’t allow for imports in scripts.
Would be nice to have python_scripts working on Hassio as I’m assuming regular python scripts don’t have access to hass.states etc. I could call the HA API using requests I suppose, but bit of a hassle.
I did initially leave the remote.py file in the config/python_scripts folder where it was initially developed (for) but after realising I couldn’t run the import function (import requests) for HTTP POST’s I eventually gave your suggestion a try.
In the python_scripts folder, even run from the command line switch as ‘python3 /config/python_scripts/remote.py’ - it just showed an event in the hass log “component failed”…so I moved the script to the config directory and updated the switch with the new location - tested it, works fine. Tres odd.
I really, really, wish the guys would get the import function working like native python - it’d open up so many more opportunities and blow the doors off hass.