In my python project to load a page with multiple tabs, I have to first import each tab's script into the main script and each of the import takes 15mins or more. Below is the original code:
import tab_1
import tab_2
import tab_3
Main code below...
I tried to use multiprocessing as below but it didnt work:
def Import_tab1():
global tab_1
import tab_1
def Import_tab2():
global tab_2
import tab_2
def Import_tab3():
global tab_3
import tab_3
t1= multiprocessing.Process(target=Import_tab1)
t2= multiprocessing.Process(target=Import_tab2)
t3= multiprocessing.Process(target=Import_tab3)
t1.start()
t2.start()
t3.start()
t1.join()
t2.join()
t3.join()
Main Code below...
I can see from print that the three tabs were importing successfully, but when I reached to main code and tried to access the tabs, I got the error message: NameError: name 'tab_1' is not defined.
Anyone can guide me on this?