A resin comprising a polyamide structure and at least any structure of an imide precursor structure and an imide structure, wherein at least any of the structures of the resin comprises a diamine residue having an aliphatic group, wherein said diamine residue having an aliphatic group does not include a siloxane structure, and wherein the polyamide structure is a structure of the general formula, and the imide precursor structure and the imide structure comprise at least one structure selected from the structures of the general formulas to, and wherein the diamine residue having an aliphatic group comprises a structural unit of the general formula, and wherein the number average molecular weight of the structural unit of the general formula is 150 to 2,000: wherein in the general formulas to, X 1 represents a divalent to hexavalent organic group, X 2 and X 3 each independently represent a tetravalent to decavalent organic group, X 4 represents a divalent to hexavalent organic group, X 5 represents a divalent to hexavalent organic group, Y 1 to Y 3 each independently represent a divalent to tetravalent organic group, and R 1 and R 2 represent hydrogen or an organic group having 1 to 20 carbon atoms; p, q, r, s, t, u, v, and w are each independently an integer number of 0 to 4; n 1, m 1, m 2, l 1, and l 2 represent molar ratio of a structure of the general formulas to, and a range of n 1:m 1 +m 2 +l 1 +l 2 = 98:2 to 50:50; the sequence of structural units of the general formulas to may be in a block manner or in a random manner wherein in the general formula, R 3 to R 6 each independently represent a C 2 -C 10 alkylene group; a, b, and c each are a integer number within a range of 1 ≤ a ≤ 20, 0 ≤ b ≤ 20, and 0 ≤ c ≤ 20; the sequence of repeating units may be in a block manner or in a random manner; and, in the general formula, * represents a chemical bond, wherein the content of the structural unit derived from the diamine having an aliphatic group is in a range of 5% to 40% by mole based on 100% by mole of structural units derived from all diamines. wherein the polyamide structure is a structure of the general formula, and the imide precursor structure and the imide structure comprise at least one structure selected from the structures of the general formulas to, and wherein the diamine residue having an aliphatic group comprises a structural unit of the general formula, and wherein the number average molecular weight of the structural unit of the general formula is 150 to 2,000: wherein in the general formulas to, X 1 represents a divalent to hexavalent organic group, X 2 and X 3 each independently represent a tetravalent to decavalent organic group, X 4 represents a divalent to hexavalent organic group, X 5 represents a divalent to hexavalent organic group, Y 1 to Y 3 each independently represent a divalent to tetravalent organic group, and R 1 and R 2 represent hydrogen or an organic group having 1 to 20 carbon atoms; p, q, r, s, t, u, v, and w are each independently an integer number of 0 to 4; n 1, m 1, m 2, l 1, and l 2 represent molar ratio of a structure of the general formulas to, and a range of n 1:m 1 +m 2 +l 1 +l 2 = 98:2 to 50:50; the sequence of structural units of the general formulas to may be in a block manner or in a random manner X 1 represents a divalent to hexavalent organic group, X 2 and X 3 each independently represent a tetravalent to decavalent organic group, X 4 represents a divalent to hexavalent organic group, X 5 represents a divalent to hexavalent organic group, Y 1 to Y 3 each independently represent a divalent to tetravalent organic group, and R 1 and R 2 represent hydrogen or an organic group having 1 to 20 carbon atoms; p, q, r, s, t, u, v, and w are each independently an integer number of 0 to 4; n 1, m 1, m 2, l 1, and l 2 represent molar ratio of a structure of the general formulas to, and a range of n 1:m 1 +m 2 +l 1 +l 2 = 98:2 to 50:50; the sequence of structural units of the general formulas to may be in a block manner or in a random manner wherein in the general formula, R 3 to R 6 each independently represent a C 2 -C 10 alkylene group; a, b, and c each are a integer number within a range of 1 ≤ a ≤ 20, 0 ≤ b ≤ 20, and 0 ≤ c ≤ 20; the sequence of repeating units may be in a block manner or in a random manner; and, in the general formula, * represents a chemical bond, R 3 to R 6 each independently represent a C 2 -C 10 alkylene group; a, b, and c each are a integer number within a range of 1 ≤ a ≤ 20, 0 ≤ b ≤ 20, and 0 ≤ c ≤ 20; the sequence of repeating units may be in a block manner or in a random manner; and, in the general formula, * represents a chemical bond, wherein the content of the structural unit derived from the diamine having an aliphatic group is in a range of 5% to 40% by mole based on 100% by mole of structural units derived from all diamines.