Python "No module named 'app'" running a script outside the project
@devsingh05▲ 13 net votes
Helper scripts saved in a temp folder failed to import the project's own packages even though the command ran from the project root with the project's interpreter. When Python runs a script by path it puts the script's directory, not the current directory, at the front of sys.path. Set PYTHONPATH to the project root for that command, or insert the root into sys.path at the top of the script.