I'm trying to do a task where I have to run poetry virtual environments and execute some code that has to run its virtual environment and execute its code in it. But there is a problem, the virtual environment remains the same.
run.bat (C:\User\Documents\prj2)
cd path/to/prj2poetry installpoetry show -v
runner.py
import subprocessimport typerdef typer_main(path_to_bath: str = typer.Argument('test')): subprocess.run(path_to_bath)def script_main():"""Точкавходадлязапускаскрипта.""" typer.run(typer_main)if __name__ == '__main__': script_main()
start.bat
poetry installpoetry run python runner.py ./path/to/prj2/run.batpoetry show -v
Run this project
./start.bat
OUTPUT
(project1-py3.10) PS C:\Users\User\Documents\project1>./start.bat(project1-py3.10) PS C:\Users\User\Documents\project1> poetry installInstalling dependencies from lock filePackage operations: 0 installs, 17 updates, 0 removals....(project1-py3.10) PS C:\Users\User\Documents\project1>poetry show -vUsing virtualenv: C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\project1-lbkdIgRk-py3.10....(project1-py3.10) PS C:\Users\User\Documents\project1>cd C:\User\Documents\prj2(project1-py3.10) PS C:\User\Documents\prj2>poetry show -vUsing virtualenv: C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\project1-lbkdIgRk-py3.10....(project1-py3.10) PS C:\User\Documents\prj2> poetry installInstalling dependencies from lock filePackage operations: 0 installs, 16 updates, 0 removals....(project1-py3.10) PS C:\User\Documents\prj2>poetry show -vUsing virtualenv: C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\project1-lbkdIgRk-py3.10....(project1-py3.10) PS C:\User\Documents\prj2>
Why the virtual environment not changed to new virtual environment?