Python multiprocessing, failed importing modules when running multiprocess from subdirectory

In python when running a multiprocessing process from a subdirectory in the project folder, the process has problem of importing the needed modules from the root directory.
Specifically I am trying to create a program that opens Edge web browser using pyautogui library. In this program I want to handle specific case like when the connection can be only opened through HTTP which shows a warning page before accessing the page. Since this warning shows only in specific cases I want to run the detection and handling logic in a separate process to not block the main thread. The problem is this open_browser function is a utility function which is utilized by many other functions in my code. This means that the multiprocess is spawned from directory 2 layers deep in the root directory.

main.py

from tests.utils.browser_utils import open_browser


def main():
    open_browser("https://192.168.7.239")


if __name__ == "__main__":
    main()

./tests/utils/browser_utils.py

import multiprocessing
from utils.multiprocess import process_wrapper

def open_browser(url):
    # Logic for opening the browser and desired url

    allow_http_traffic_process = multiprocessing.Process(
        target=process_wrapper, args=(allow_http_traffic,), name="Allow http traffic"
    )
    allow_http_traffic_process.start()

    # Additional logic to verify if page opened successfully


def allow_http_traffic():
    # Try to locate and close the allow HTTP traffic

./tests/utils/process.py

import os
import sys


def process_wrapper(func, *args, **kwargs):
    current_dir = os.path.dirname(os.path.abspath(__file__))
    parent_dir = os.path.dirname(current_dir)
    project_dir = os.path.dirname(parent_dir)

    if current_dir not in sys.path:
        sys.path.insert(0, current_dir)
    if parent_dir not in sys.path:
        sys.path.insert(0, parent_dir)
    if project_dir not in sys.path:
        sys.path.insert(0, project_dir)

    os.chdir(project_dir)

    return func(*args, **kwargs)

As shown in the code i tried to create a wrapper function which changes working directory and adds the project root directory to the processes path, which actually works and the path is added but the module importing still fails. Exception. The other option is to make the allow_http_traffic function into a separate python file and run it using subprocess module as a standalone process, which may solve this issue but it would not make sense in my project directory and contextual structure.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật