[Python] Not able to import module after adding folder to path

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to import a module based on this RDKit blog: https://greglandrum.github.io/rdkit-blog/posts/2023-12-01-using_sascore_and_npscore.html but it won't work if I try to include it in a separate file. The following works in a jupyter cell:

    try:
    from rdkit.Contrib.SA_Score import sascorer
    except ImportError:
    import sys
    import os
    sys.path.append(os.path.join(os.environ['CONDA_PREFIX'],'share','RDKit','Contrib', 'SA_score'))

    import sascorer


    However, if I include that in a python script and define some other function, trying to import that function gives me an ModuleNotFoundError.

    Continue reading...

Compartilhe esta Página