from __future__ import print_function
import os
import sys
import inspect


if __name__ == "__main__":
    base_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    commands = ['. {}'.format(os.path.join(base_path, 'virtual.fish'))]

    for plugin in sys.argv[1:]:
        path = os.path.join(base_path, plugin + '.fish')
        if os.path.exists(path):
            commands.append('. {}'.format(path))
        else:
            print('virtualfish loader error: plugin {} does not exist!'.format(plugin), file=sys.stderr)

    commands.append('emit virtualfish_did_setup_plugins')
    print(';'.join(commands))
from __future__ import print_function
import os
import sys
import inspect


if __name__ == "__main__":
    base_path = os.path.dirname(os.path.abspath(__file__))
    commands = ['. {}'.format(os.path.join(base_path, 'virtual.fish'))]

    for plugin in sys.argv[1:]:
        path = os.path.join(base_path, plugin + '.fish')
        if os.path.exists(path):
            commands.append('. {}'.format(path))
        else:
            print('virtualfish loader error: plugin {} does not exist!'.format(plugin), file=sys.stderr)

    commands.append('emit virtualfish_did_setup_plugins')
    print(';'.join(commands))

Use __file__ to find find the module
Use __file__ to find find the module

`inspect.getfile(inspect.currentframe())` seems to return a relative path that
ends up with the virtualfish functions not being loaded.

  from __future__ import print_function
  import os
  import sys
  import inspect
  
  
  if __name__ == "__main__":
-     base_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+     base_path = os.path.dirname(os.path.abspath(__file__))
      commands = ['. {}'.format(os.path.join(base_path, 'virtual.fish'))]
  
      for plugin in sys.argv[1:]:
          path = os.path.join(base_path, plugin + '.fish')
          if os.path.exists(path):
              commands.append('. {}'.format(path))
          else:
              print('virtualfish loader error: plugin {} does not exist!'.format(plugin), file=sys.stderr)
  
      commands.append('emit virtualfish_did_setup_plugins')
      print(';'.join(commands))
+ 
Use __file__ to find find the module
## Code Before:
from __future__ import print_function
import os
import sys
import inspect


if __name__ == "__main__":
    base_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    commands = ['. {}'.format(os.path.join(base_path, 'virtual.fish'))]

    for plugin in sys.argv[1:]:
        path = os.path.join(base_path, plugin + '.fish')
        if os.path.exists(path):
            commands.append('. {}'.format(path))
        else:
            print('virtualfish loader error: plugin {} does not exist!'.format(plugin), file=sys.stderr)

    commands.append('emit virtualfish_did_setup_plugins')
    print(';'.join(commands))
## Instruction:
Use __file__ to find find the module
## Code After:
from __future__ import print_function
import os
import sys
import inspect


if __name__ == "__main__":
    base_path = os.path.dirname(os.path.abspath(__file__))
    commands = ['. {}'.format(os.path.join(base_path, 'virtual.fish'))]

    for plugin in sys.argv[1:]:
        path = os.path.join(base_path, plugin + '.fish')
        if os.path.exists(path):
            commands.append('. {}'.format(path))
        else:
            print('virtualfish loader error: plugin {} does not exist!'.format(plugin), file=sys.stderr)

    commands.append('emit virtualfish_did_setup_plugins')
    print(';'.join(commands))
