473,386 Members | 1,846 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,386 software developers and data experts.

RE: PyDev multiple source files?

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 = xyz.myclass()
or
from xyz import myclass #if you're lazy use ... import *
x = myclass()

see the basic tutorial on modules and importing
-----Original Message-----
From: py*******************************************@pyth on.org
[mailto:py***************************************** **@python.org]On
Behalf Of RossGK
Sent: Friday, May 30, 2008 2:10 PM
To: py*********@python.org
Subject: 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.
--
http://mail.python.org/mailman/listinfo/python-list
Jun 27 '08 #1
0 1099

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

Similar topics

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:...
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:...
1
by: RossGK | last post by:
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...
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:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.