Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class File
#1
Hi,

I have saved my 'class xyz' as abc.py at some location.

now I have another editor window in which I want to write a code to create an object of 'xyz'.

Please help.

Many thanks in advance.
Reply
#2
import abc
x = abc.xyz()
abc.py either needs to be in the same folder as this code, or it needs to be in your pythonpath.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Custom file class deanhystad 11 1,610 Feb-01-2021, 05:09 PM
Last Post: nilamo
  import just one class from a file sylas 4 1,901 Apr-25-2018, 08:56 PM
Last Post: sylas

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020