0

Is it possible to import a variable from a running python script into another script. Something like notebooks cells, but with scripts. For example, load a neural network model and use it in another script so as not to load it every time it starts.

1 Answers1

0

The are a lot of ways doing it, here are some of the most popular from easy to harder:

  1. Save the variable into a file, read it from the other script.
  2. Save the variable into some kind of environment variable, use it from the second script.
  3. Open a socket between the scripts and communicate through it.
Daniel Nudelman
  • 376
  • 3
  • 10