[Tutor] Search package for path to class

Joel Goldstick joel.goldstick at gmail.com
Wed May 11 17:22:14 EDT 2022


On Wed, May 11, 2022 at 5:15 PM Julius Hamilton
<juliushamilton100 at gmail.com> wrote:
>
> Hey,
>
> In a Python shell I would like to find the path to a class in a package in
> order to import it.
>
> So if class “ServiceRunner” is imported via yapapi.services.service_runner
> but I don’t know that, I would like to do something like:
>
> find(“ServiceRunner”)
>
> and return the result
>
> “yapapi.services.service_runner” - assuming I already imported yapapi.
>
> How would this be possible?
>
> Thanks very much,
> Julius
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor

I'm not sure if pydoc would do what you want to do, but you could play
around with it.  It's a great tool.  I think it comes with a standard
python install.

-- 
Joel Goldstick


More information about the Tutor mailing list