Hacker News new | ask | show | jobs
by ptx 1196 days ago
Does it? As far as I know, it loads modules from the script's directory (which is usually fine), not from the current working directory.

  $ mkdir bin_dir
  $ echo 'print("mymod loaded as expected.")' >bin_dir/mymod.py
  $ echo 'import mymod' >bin_dir/script.py

  $ mkdir working_dir
  $ echo 'print("Oops, game over!")' >working_dir/mymod.py

  $ cd working_dir/
  $ python3 ../bin_dir/script.py
  mymod loaded as expected.