<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 12/13/19 3:02 PM, Matthew Brush wrote:<br>
<blockquote type="cite"
cite="mid:3e8a5260-20d5-b1d4-634a-6e714a08b760@codebrainz.ca">I'm
not sure exactly what you're going for, but often you will have
your main script in the top level, and then put common/library
code in a package directory, with an (often empty) `__init__.py`
file. Something like this: <br>
<br>
- py <br>
- main.py <br>
- common <br>
- __init__.py <br>
- fun.py <br>
<br>
If you lay it out like this, it "Just Works" out of the box with
Geany's execute command for `main.py`, without messing with any
path variables or anything. <br>
<br>
If you want to leave it where `main.py` is in a directory that is
a sibling of your common/library package, you will probably have
to mess with paths and/or use some kind of relative imports. <br>
<br>
I don't think your problem is with Geany as much as with trying to
understand Python's quite complicated import
mechanisms/rules/conventions. <br>
</blockquote>
Amen<br>
<blockquote type="cite"
cite="mid:3e8a5260-20d5-b1d4-634a-6e714a08b760@codebrainz.ca"> <br>
Hope that helps. <br>
<br>
Regards, <br>
Matthew Brush
</blockquote>
<p>============================================</p>
<p>What I'm looking for is a way to structure multiple python
applications that all make use of user defined functions (VFP
jargon perhaps) stored in a python script (this is how I did it
with multiple PHP apps).<br>
</p>
<p>I followed your suggestion and took the liberty of adding a
second script, main1.py. <b>Both worked</b> even without
__init__.py. <b><br>
</b></p>
<p> - py
<br>
- main.py <br>
</p>
<p> - main1.py</p>
<p> - common
<br>
- fun.py </p>
<p>But my problem is that main.py and main1.py really represent
separate applications each with multiple files. The only way I
know of organizing apps is to place their files in their own
directory. So I tried <br>
</p>
<p> - py <br>
</p>
<p> - app1</p>
<p> - main1.py</p>
<p> - app2<br>
</p>
<p> - main2.py</p>
<p> - common <br>
- fun.py <br>
</p>
<p>Even though this seems to be the same structure as I started with,
both main1.py and main2.py worked. So it appears Geany is now
accepting /home/paul/py as being in the PYTHONPATH. Since common
is downstream of that, it works.</p>
<p>Thank you.</p>
<p>PS: I'm sure this belongs in a separate thread; but I got cocky
and tried an alarm clock program that I had written involving a
tkinter GUI. It worked fine in Idle; but all I got from Geany was
a terminal window telling me the exit code was 0. Using the
ancient dicotomy of system vs. applcation programing, wouldn't it
be fair to say all application programs are GUI?</p>
<p>Paul<br>
</p>
<blockquote type="cite"
cite="mid:3e8a5260-20d5-b1d4-634a-6e714a08b760@codebrainz.ca">_______________________________________________
<br>
Users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.geany.org">Users@lists.geany.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.geany.org/cgi-bin/mailman/listinfo/users">https://lists.geany.org/cgi-bin/mailman/listinfo/users</a>
<br>
</blockquote>
</body>
</html>