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

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 1096

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: 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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
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.