I have a python module which is really big (more than 1 Gigabyte) and I'm importing a class from this module in another python script with the command from module import class
. The thing is, when I firt launch my python script, the memory consumption is really high and the script takes a very long time to execute (few minutes!). When launching it after that, it takes significantly less time (a few seconds) and uses less memory but still a lot for me.
What I think my script does is that it loads all the data from the module when I first launch it into memory which is why it takes so much time and memory.
Is there a way to change that and not have my script import the whole module but only specific parts which I would like ?
Thanks for taking the time to answer :)