Dependency conflict

HI,

I have developed a custom 3d slicer module. It used to call a deep learning module and executes the code perfectly.
This is the repo:
AMK-AQ/CTPelvic1K: Resources of the paper “Deep Learning to Segment Pelvic Bones: Large-scale CT Datasets and Baseline Models”. This version is compatible with Windows also. (github.com)

But as I upgraded my python to 3.12, it started to throw error, as standard library module disutils got deprecated in this version.

Now, if I install the CTPelvic1K with poetry and create a virtual environemnt with 3.10, everything works fine.

I wanted to ask, is there a way to activate a virtual environemnt through python , execute my deep learning code and exit the environment?

Or should I use some other option, like docker etc?

Thanks