Open Shohreh opened 3 years ago
Hi @Shohreh!
This has to do with the way Python importing works. When you import a module (such as gpxpy), it does not provide access to submodules (such as gpxpy.gpx) unless they are explicitly imported by the main module (which they aren't here).
One way to see this is to start the Python REPL at the command line (if you run just python
, you'll probably be there), and try the following:
> import gpxpy
> dir(gpxpy)
The dir command will list everything in the supplied namespace. You'll see lots of things listed, but not gpx (the submodule).
Perhaps part of the confusion is that many library authors will import the submodules into the main module (or at least the ones meant to be public) as a convince, but as shown here, it isn't a requirement.
Hope that helps!
Hello,
It's a newbie question: Why is the module imported twice?
https://pypi.org/project/gpxpy/
Thank you.