On Mon, Dec 9, 2019 at 3:31 AM R.Wieser <address@not.available> wrote:
>
> Hello all,
>
> Using Python3 I would like to import a specific class from another file (in
> the same folder), and have trouble doing so.
>
> "from file import function" works, but fails when I try to do the same with
> a class.
>
> "import file
> x = file.class"
>
> works, but also executes commands that are in the root of the file. And
> ofcourse loads all of the file, not just the class that I'm after ...
>
> In other words, what is the syntaxt I should use ?
>

Are you sure there's a difference between classes and functions here?
Try "from file import function" and see if it runs commands at the
root of the file.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to