import os etc are python lines (interpreted by Python), python -m http.server 8000 is a shell line, interpreted by bash, sh or whatever Microsoft use for Windows. You may try something like this to run it in the Python REPL: