[Python] sys.path.insert(0, '..') not working in py file while working in juyter notebook

Discussão em 'Python' iniciado por Stack, Outubro 6, 2024.

  1. Stack

    Stack Membro Participativo

    I have a py file saved in a subfolder and it need to import a module in main folder which is one level up. I am using sys.path.insert(0, '..'). Then it works whenthe code is executed in cell in jupyter notebook. However it doesn't work when code is written in py file. any reason? Thanks

    import sys

    sys.path.insert(0, '..')

    from python_environment_check import check_packages

    ModuleNotFoundError: No module named 'python_environment_check'

    Continue reading...

Compartilhe esta Página