473,289 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

How to find imported modules

My Main program imports several other smaller programs.
for example
Main.py
imports
Program1.py
Program2.py
....
Program50.py

Now I need to find out which of Programs imports a particular module
- module timesocket.py
Is that possible without opening each program?
Thanks
B.

Oct 16 '07 #1
2 1414
On Oct 16, 3:46 pm, Johny <pyt...@hope.czwrote:
My Main program imports several other smaller programs.
for example
Main.py
imports
Program1.py
Program2.py
...
Program50.py

Now I need to find out which of Programs imports a particular module
- module timesocket.py
Is that possible without opening each program?
Thanks
B.
It is with grep on *nix, or you could download baregrep for windows,
which is what I use when I need to know this sort of thing.

Mike

Oct 16 '07 #2
En Tue, 16 Oct 2007 17:50:06 -0300, <ky******@gmail.comescribió:
On Oct 16, 3:46 pm, Johny <pyt...@hope.czwrote:
>Now I need to find out which of Programs imports a particular module
- module timesocket.py
Is that possible without opening each program?

It is with grep on *nix, or you could download baregrep for windows,
which is what I use when I need to know this sort of thing.
On Windows there is no need to download anything, you can use the findstr
utility:

findstr /R /S /C:"import *timesocket" /C:"from *timesocket *import" *.py

--
Gabriel Genellina

Oct 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Berteun Damman | last post by:
Hello, First I was trying to get PyOSD, but as soon as I did `import pyosd' Python received a SIGABRT. Then I wrote my own module, which looks like: #include <Python.h> static PyMethodDef...
4
by: Andreas Neudecker | last post by:
Hi. I know you can read the filename of a program as sys.argv. But what about modules? Is there a similar way to find out the file name of a module (called by some other module or program) from...
3
by: Jason | last post by:
Hi, I've been having trouble understanding the difference between global namespace within and between modules. For example, I can program a subthread to see a global name (a threaded event to...
2
by: Casey Hawthorne | last post by:
Is there a way to determine -- when parsing -- if a word contains a builtin name or other imported system module name? Like "iskeyword" determines if a word is a keyword! -- Regards, Casey
3
by: Zachary Pincus | last post by:
Hi folks, I'm sure this has come up before, but the search terms I've been using are so non-specific that I can't get any traction on Google. Here's my question: I have written a subclass of...
3
by: schpok | last post by:
When I "from foo import *" in my __init__.py, sometimes module foo's docs will be expanded in the pydocs. It seems to depend in what language foo was implemented. For example, if you "from math...
3
by: Mohamed Yousef | last post by:
Hello , The problem I'm asking about is how can imported modules be aware of other imported modules so they don't have to re-import them (avoiding importing problems and Consicing code and...
0
by: Mohamed Yousef | last post by:
Hello , The problem I'm asking about is how can imported modules be aware of other imported modules so they don't have to re-import them (avoiding importing problems and Consicing code and...
0
by: Terry Reedy | last post by:
Mohamed Yousef wrote: If you want to use module A in both B and C, B and C should both import A. No problem. ??
4
by: Mohamed Yousef | last post by:
On Sun, Aug 24, 2008 at 9:59 AM, Fredrik Lundh <fredrik@pythonware.comwrote: why isn't it a good thing (even if optional) consider the sitution in which a utility module is used every where else -...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.