Run python code at startup

#1

hi
i wrote a code and called some module in python such as tensorflow ,keras, matplot, skfuzzy and flyt_python. all the code run well when i excute the code by python mycode.py command in terminal .but when i want to run the code at startup the flyt_python module can’t run.


i think the problem related to user but i dont know how solve it.
help me please .

#2
from flyt_python import api
drone = api.navigation()

pls ensure your code is similar to above.

#3

hi.
my code exactly like the code you wrote.
its better to show the problem by a sample.
i wrote a python program that just have 2 lines.

from flyt_python import api
drone = api.navigation()

and named it sample.py
then execute it by commandpython sample.py and the result is:


and then execute the code by sudo python sample.py and the result is :
when i use sudo the flyt_python module was unknown for python.

#4

i dont want to run the program on terminal .i want to run it in startup.

#5

Run the following commands:

$ sudo -s
$ python sample.py

This will work.