I can confirm that sourcing profile.sh[/i] (with [i]source /opt/salome_meca/Salome-V2021-s9/tools/Code_aster_stable-1540/share/aster/profile.sh when inside the singularity container) is enough to get everything registered and working correctly. Actually I don't know how this scripts can be used from outside the container.
I didn't have to do anything else, no modifications to this file or other PYTHON_PATH modifications were necessary
I also find it easier to log in to the singularity container and then run python from there, instead of doing it in on step, i.e. instead of ./salome_meca-lgpl-2021.0.0-2-20211014-scibian-9 -- shell -- python3 test.py[/i], I do first [i]./salome_meca-lgpl-2021.0.0-2-20211014-scibian-9 -- shell and then start python like in any other shell
To sum up this is what I do:
1. ./salome_meca-lgpl-2021.0.0-2-20211014-scibian-9 -- shell (log into the container)
2. source /opt/salome_meca/Salome-V2021-s9/tools/Code_aster_stable-1540/share/aster/profile.sh (source the environment)
3. run any python-script, e.g. python3 runCA.py