0

I was wondering how I can combine multiple projects, each of them within an own virtual environment, to one global project.

For example this structure:

Python
|
|-- Send_Mails
|   |-venv
|   |-main.py
|
|-- Create_Files
|   |-venv
|   |-main.py
|
|-- Scrape_Web
|   |-venv
|   |-main.py

Each project has it own purpose, but from time to time I need a Send_Mails function within Create_Files. I wasn't able to simply import the send mail function from Send_Mails inside of Create_Files due to a ModuleNotFoundError.

What is the trick to do this?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Stacknewb
  • 1
  • 1
  • I would rather copy code to new single venv – furas Oct 31 '22 at 09:47
  • Extract reusable code into libraries. Install those libraries (as "editable") into each virtual environment as needed. – sinoroc Oct 31 '22 at 09:48
  • Is there no other way to keep the code up to date even if I make changes? Manually copying the code seems error prone in case I forget to copy something. – Stacknewb Oct 31 '22 at 10:02
  • why would you do that? a single env is the way to go. – Axeltherabbit Oct 31 '22 at 11:14
  • For example Send_Mails is used in multiple other Projects, it is much clearer to use one Code from one location rather then Copy and Paste it in each Project. But each Project is cleaner within a own venv. @sinoroc thanks, I didn't know the "editable" option, this could be the solution I was looking for. – Stacknewb Oct 31 '22 at 11:33

0 Answers0