473,289 Members | 1,840 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.

PyDev multiple source files?

Newbie questions on PyDev project setup. Things are going fine -
writing python code in eclipse/pydev and running them with various
imports etc, doing wxpython stuff blah, blah, blah. My .py code is in
a module, in a package, in a project. It runs fine.

Now I want to be able to break my single source file up into multiple
files to segregate functions, divide up with others, etc, but I don't
know how to configure it. I pulled one simple class definition out of
my single source file and created a new .py file with just that in
there. But now I'm stalled...

What is the equivalent of an 'include' statement. I assume there's
something I put into one .py file to say I'm using stuff in another
local .py file. I tried using "import" but it doesn't seem to work -
ie code doesn't know about the class in the other file.

Also, how about global vars that are needed across multiple .py files?
Where do I declare them to be understood in all the files that use
that global.

I suspect there is something I do in __init__.py - perhaps the
equivalent of 'include' statements in there with all my globals
stuffed in there too??? I'm lost here, but will continue to play
with it. Any hints appreciated. Surely all python developers don't
cram everything into one huge file (I hope).

Ross.
Jun 27 '08 #1
1 2817
On May 30, 2:10 pm, RossGK <ros...@gmail.comwrote:
Now I want to be able to break my single source file up into multiple
files to segregate functions, divide up with others, etc, but I don't
know how to configure it.
Found a reference that helped me out:

http://www.python.org/doc/2.1.3/tut/node8.html

The keys for me are that a) a file named junk.py is called a module (I
thought a module was a set of files within a package - nope just a
source file).

Import is the right thing for an 'include' action - but after you
import you need to hierarchically reference the contents of the
imported module. So if my junk.py 'module' contains a "def things",
then after I have done my "import junk" I refer to things as
junk.things

Global seem to have a scope of only their current module. So the
question that comes to mind is how to create a global global. Can I
stick it into __init_.py or something and have it available for the
whole package?
Jun 27 '08 #2

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

Similar topics

0
by: Kenneth McDonald | last post by:
The first is general; what are users' experience with PyDev for Eclipse. It looks pretty good to me right now, but I've only started playing with it. Converting to Eclipse is a major effort, and if...
3
by: coujou | last post by:
It's all in the title. Is there a way (using Pydev) to debug code written for and executed by python 2.2 ? I have only the 2.2 interpreter installed. The run command works fine but the debugger...
0
by: WChunming | last post by:
Hi, I am a newbie to python and pypy. I choose to read pypy source code to learn about python and python library. But when I try to run pypy in debug mode in pydev, I got the following problem:...
4
by: king kikapu | last post by:
Hi, i am using Eclipse (Platform Runtime binary) with PyDev and i was wondering if someone can help me with this: 1. I set breakpoints to a .py file and i have told Eclipse to open the Debug...
8
by: Nebur | last post by:
Hi folks developing with Pydev/Eclipse, this is the second time in about half a year that the following surprise bites me: I've switched between some files in Pydev/Eclipse using the...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.16 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development:...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.17 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development:...
0
by: Sells, Fred | last post by:
the short answer is a file is a module; therefore to 'include' access to 'myclass' in file xyz.py from another file called 'abc.py' you would put this in abc.py import xyz #note no '.py' x =...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.23 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development:...
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: 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
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...
1
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: 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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.