sheng chen
sheng chen

Reputation: 3

Import variables in python

I ran a python script to create a dict variable based on a database, and then I pickled this variable into disk file for later usage. Now I have a lot of feature classes which all need that variable to create different features. The thing is the dict variable is so large that cannot afford to import multiple times. I am wondering if there is a way I can unpickle and import that variable for only once, and then all feature class can share it?

Upvotes: 0

Views: 185

Answers (1)

unholysampler
unholysampler

Reputation: 17341

Python will only import the module once. Any code that executes at load time will only be executed the first time a file imports the module.

Upvotes: 3

Related Questions