Relative Content

Tag Archive for pythonpython-multiprocessingpython-module

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.