How to run .py files

I have a model in a .py file that I want to run on the JupyterLab connected to a GPU in the company. Yesterday, I tried loading and running the .py file using .ipynb. This morning, I found that the dependencies installed yesterday were not saved. My colleague suggested running the Python file in conda. What should I do?