|
|
||||||
|
#1
|
|
|
|
|
Hi,
I've a module report.py having a set of funtions to open/close/write data to a log file. I invoke these functions from another module script.py. Whenever I'm changing something in report.py, I'm running the file (however, it has not effect). After that I'm running script.py again. However, the output is not taking effect. If I shut the IDLE interpreter and all the other files and then reopen again; and then run script.py, the output is taking effect. Is there any way to improve it? I'm new to Python. -Gopal. |
|
|
|
#2
|
|
|
|
|
Gopal wrote:
> Hi, > > I've a module report.py having a set of funtions to open/close/write > data to a log file. I invoke these functions from another module > script.py. > > Whenever I'm changing something in report.py, I'm running the file > (however, it has not effect). After that I'm running script.py again. > However, the output is not taking effect. > > If I shut the IDLE interpreter and all the other files and then reopen > again; and then run script.py, the output is taking effect. > > Is there any way to improve it? I'm new to Python. > > -Gopal. > you could try "reload(module)" instead of "import module" or running the file. |
|
#3
|
|
|
|
|
Gopal wrote:
> I've a module report.py having a set of funtions to open/close/write > data to a log file. I invoke these functions from another module > script.py. > > Whenever I'm changing something in report.py, I'm running the file > (however, it has not effect). After that I'm running script.py again. > However, the output is not taking effect. > > If I shut the IDLE interpreter and all the other files and then reopen > again; and then run script.py, the output is taking effect. > > Is there any way to improve it? I'm new to Python. If I understand you correctly, you are importing your module report in script.py. If so, you need reload. When in IDLE, you have a python process running, in which you execute your program. The first time you run script.py after starting IDLE, your module report is imported from file. The next time you run script.py, there is already a module named report in memory. Then the corresponding file will not be executed again. Instead, the one in memory will be used. What I do when I am developing a module for a program is that I both import and reload the module in my main file. Once I think I am done developing, I remove the reload statement. So, in your script.py, I would write: import report reload(report) HTH /MiO |
|
|
| Similar Threads | |
| Problem calling Error Handler in Standard Module from Form Module I've followed 2 books exactly, as far as I can tell, but "it" doesn't work. I have in a Standard Module [modBusinessLogic]: _____________________________ ' General Error... |
|
| calling another module from within module I have an auto_open() sub (module1) and I want to call a macro I recorded in excel(module2) from within the auto_open module/sub. How can I do that? |
|
| Calling worksheet module from other module. I have a module in Sheet1 that automatically refreshes the data retrieved from a database. I have other modules that could affect that sheet, but if Sheet1, the sheet does... |
|
| Help with Calling a Module within a Module Simple problem, but I'm confused, I'm trying to call a module "TextToData" within the following code, but its coming up with a compile error. My code (I thought would work)... |
|
| module calling another module First, do I have my terms right? Is this called a module? Private Sub cboRestartReports_Click() 2nd, how do I call one module from another module? I want to go to: ... |
|
|
All times are GMT. The time now is 02:44 PM. | Privacy Policy
|