L
L
leham12020-06-10 12:46:03
Python
leham1, 2020-06-10 12:46:03

Is it possible to recalculate a variable that is in another module?

I have two scripts. In script No. 1, I write the functions and variables I created. And in script No. 2 I use these functions and variables.
Script #1 has variables

wb = load_workbook(filename=path_excel_limit_obyavlenii)
ws = wb.active

and many functions using these variables.

In a certain place, when executing script No. 2, it is necessary that variables are recalculated in script No. 1
wb = load_workbook(filename=path_excel_limit_obyavlenii)
ws = wb.active

so that the book opens with the recalculated formulas (the formulas will already be recalculated. It is only necessary that the variables are recalculated in script No. 1, because there are a lot of functions in this script that use these variables)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alan Gibizov, 2020-06-10
@leham1

Do you want the constants to change based on the results of the second script? And the first script next time used the new constants?
Then probably they should be moved to a separate file or database. And from there to pull up at each start of the 1st script.
Or, as an option, run the script with the necessary parameters.
You can reload the script like this:

import my_module
reload(my_module)
from my_module import *

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question